Implement a logger : Root level logger middleware should be active

Hello

I’m on the exercice BackEnd : Implement a Root-Level Request Logger Middleware

The interest of the function is for each log request, the programm return :
method : ( Get, Post, Update or Delete )
the path :
the ip : ( ip address of the request ? )

So i’m not sure about understanding middleware.
But for sur i can’t valid the exercice so here is my link and my code below

https://replit.com/@frogfox/FreeCodeCamp-express-OK

Your browser information:

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

Challenge: Implement a Root-Level Request Logger Middleware

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

IF u check the example…

function(req, res, next) {
  console.log("I'm a middleware...");
  next();
}

it calls next() function/method (which comes from the function parameter)
its not part of the string

Your “app.use” Middleware (lines 23 - 26) should be executed first before app.post (line 13). You can solve it by modifying or simply just “cut” lines 23-26 and “paste” it into line 11.

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