Implement a logger : Root level logger middleware should be active


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

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:

IF u check the example…

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

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 (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.