Basic Node and Express - Implement a Root-Level Request Logger Middleware

Tell us what’s happening:

I am getting following error when submiited for check.I don’t understand what the error means?

Root level logger middleware should be active.

Your code so far

let express = require('express');
let app = express();
require('dotenv').config();

app.get("/", function(req,res){
    res.sendFile(__dirname + "/views/index.html")
})

// app.use("/public", express.static(__dirname + "/public"))
app.use(function(req, res, next){
    res.send( console.log(req.method +" "+ req.path +" - "+ req.ip));
})
 module.exports = app;

Your browser information:

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

Challenge Information:

Basic Node and Express - Implement a Root-Level Request Logger Middleware

Hi @mahassan

Try removing just the res.send() part.

Happy coding

If I remove that, it will removed all the items that is said in the exercise

Keep the contents, just remove the wrapper.

You are asked to console.log the properties, not res.send a console.log (which doesn’t work anyway).

You have to call next() after you log the values.