-2

I am trying to implement a middle ware that accepts any incoming request and logs all the request parameters, so how can I do that using express?

I tried this code but didn't work,

//logger function
app.use(function(req, res, next){
  console.log('%s %s', req.method, req.url);
  next();
});

Thanks.

user1861639
  • 77
  • 1
  • 8

1 Answers1

0

As the comments have mentioned: see the document.

I want to warn you another thing:

do not write user's account info(e.g.: email,password) in the log file,it's dangerous!

yangsibai
  • 1,569
  • 11
  • 23