HELP! Root-Level Request Logger Middleware

Tell us what’s happening:
This is my code. I have it before the other functions in myApp.js file, but it’s not allowing me to move on and I am just lost on what to do. I’ve read the documentation on middleware functions but I can’t seem to see where I’m wrong.

Describe your issue in detail here.

app.use(function middleware(req, res, next) {
console.log(req.method + " " + req.path + " - " + req.ip);
next();
})

Your project link(s)

solution: http://localhost:3000/json

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36

Challenge: Implement a Root-Level Request Logger Middleware

Link to the challenge:

Submit http://localhost:3000 not http://localhost:3000/json

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.