I would like to do something like:
app.On_All_Incoming_Request(function(req, res){
console.log('request received from a client.');
});
The current app.all() requires a path, and if I give for example this / then it only works when I’m on the homepage, so it’s not really all..
In plain node.js it is as simple as writing anything after we create the http server, and before we do the page routing.
So how do I do this with express, and what is the best way to do it?
Express is based on the Connect middleware.
The routing capabilities of Express are provided by the
routerof your app and you are free to add your own middlewares to your application.It’s that simple.
(PS : If you just want some logging you might consider using the logger provided by Connect)