I’m using the following middleware :
app.use(function(req,res,next){
console.log(req.url)
next()
});
but it catches every request, including images/css/js etc…
If I just want to catch the actions, what should I do?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could put your “static handler” middleware before this one, if the request matches the static middleware route, it should not reach your middleware at all.
So try: