Node JS Express JS Problem

Tell us what’s happening:
Describe your issue in detail here
how do you complete it.

Your project link(s)

solution: https://replit.com/@sonicx180/boilerplate-express-4

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS aarch64 14092.46.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.69 Safari/537.36

Challenge: Implement a Root-Level Request Logger Middleware

Link to the challenge:

What have you tried so far?

app.use(function(req,res,next){

var string = req.method + " " + req.path + " "+ “-” + req.ip;

console.log(string);

next();

})

Have you checked the logs to see the output? You’re missing a space in your string template.

what do you mean by that?

Per the instructions, you should log in the format method path - ip

Your output does not match that format.

it says GET /public/style.css -my ip address

Right, that’s close but it’s missing a space. So it’s wrong because it doesn’t match the format exactly.

I see, let me fix it.

fixed!!! (Had to include !!!)

I t still doesn’t work.

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