Unable to complete challenge in Express where we have to log a root level middleware

Tell us what’s happening:
Describe your issue in detail here.

Your project link(s)

solution: https://replit.com/@subodhbarthwal/boilerplate-express

Your browser information:

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

Challenge: Implement a Root-Level Request Logger Middleware

Link to the challenge:

Im having the same problem as this dude, I get the error that “Root level logger middleware should be active”

app.use((req, res, next) => {
  console.log(req.method + " " + req.path + " - " + req.ip);

This is my code

Ok I found something that works… try placing the logger right at the start of your code, but right after the variables obviously.

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