Getting Error "Root level logger middleware should be active"

Tell us what’s happening:

Getting Error “Root level logger middleware should be active”

Your code so far

My code is

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36.

Link to the challenge:
https://www.freecodecamp.org/learn/apis-and-microservices/basic-node-and-express/implement-a-root-level-request-logger-middleware

1 Like
Following Code help me to solve this challange
app.get('/json', function(req, res, next){
console.log(`${req.method} ${req.path} - ${req.ip}`);
next();
})

3 Likes