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