Question: Create a new express router to handle all requests to / users , and use it in the application, the endpoint / users should return

Create a new express router to handle all requests to /users, and use it in the application, the endpoint/users should return all users.
Add a new route /users/create that will add a new user to the users array, and create a router-level middleware function that will log the request body if found (use the correct HTTP method).
Create a new express router to handle all requests to /products, and use it in the application.
Create a products array that has the following items keyboard, mouse and then add a route to update the items /products/update in the array, it should replace one of the values with the new value (use the correct HTTP method).
Create a new router-level middleware attached on the products router that will log the products router request path at every HTTP request.
Create an application-level error-handling middleware, that has the message of NOT FOUND and a status code of 404 and that will be called when trying to access unassigned endpoints.
Create a new express router to handle all

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!