Skip to main content

Exercise 15

  • Create the following folder/file structure:
/ex_15
|-- index.js

index.js

  • Create a Express web server using port 3000
  • Create the following routes:
    • GET '/': Returns the following JSON object
    {
    "status": 200,
    "message": "Este request/response está OK"
    }
  • Create the following middleware:
const requestTime = (req, res, next) => {
const message = `Request: ${req.baseUrl} ${Date.now()}`;
console.log(message);

next();
};
  • Configure express to use the requestTime middleware
  • You should see the following output on each request (Server console):
Request 1506002876731