Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Node.js provides service at http://localhost:8088/ (for the get) and http://localhost:8088/api/user (for the post). The main file should be server.js. To run the app, use

The Node.js provides service at http://localhost:8088/ (for the get) and http://localhost:8088/api/user (for the post). The main file should be server.js. To run the app, use the command node server.js

Get Request Process

If the user access the http://localhost:8088/ using a get request, it return the following page to the user. All the view file and style files (should be in a static resource folder) are retrieved from the backend.

1)Put User Login in the center, set its font size to 20pt and color to blue

2)Create a form and set its width to 400px, height to 250px and put it in the center of browser (hint: set both margin-left and margin-right style to auto). Set its margin-top to 20px and padding (all sides) to 10px. Set its border to 5px solid orange.

3)Create label for each input box (maximum length is 12). The first text input is for user name and the other two are for password (it shows star when you type in something set its TextMode property to Password). All align to left and put label and its input box in the same line with margin-top to 20px.

Create a submit button

When user clicks on the submit button, it posts the user data to the backend http://localhost:8088/api/user.

Post Request Process

In the backend Node.js application, the code validates all user inputs. If there is any error, it sends the page back as the following:

All input boxes must have text whose length is >=4 and <=8. If any of the input text is too short or too long, set the message label text to The length of user name and password must be between 4 and 8. The message should be in red color.

The password and verified password have same text. Otherwise, set message label text to The passwords are different. The message should be in red color.

If the inputs are valid, the backend generates a user id, starting from 1001, increase by 1 for each request and send back to the front end. The front end displays the result with a message: The user is created with an id of 1001. Creating another user will create a user with id of 1002.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine Ricardo

2nd Edition

1449606008, 978-1449606008

More Books

Students also viewed these Databases questions

Question

u = 5 j , v = 6 i Find the angle between the vectors.

Answered: 1 week ago