Checking Express docs I saw this kind of solution below:
app.all('/*', function(req, res) {
console.log('Intercepting requests...');
});
Its really intercept the request and output on the console the message. The problem is the execution process of the site doesn't stop, the request doesn't ends and seems to be in a kind of loop. There is another way to simulate filters on Express or can't do it right now?
Thanks!
You have to add next
as a parameter to your function and then call it inside when you're done with logging
app.all('/*', function(req, res, next) {
console.log('Intercepting requests ...');
next(); // call next() here to move on to next middleware/router
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With