app.use(function (req, res, next) { console.log(req.?, 'routename'); next(); }); 

Actually how can I get the name of the router?

  • Can you explain more specifically what is required and why? - Aleksei Zabrodskii
  • @elmigranto if you use the usual route app.get (...) and in the req object there is a route property, but in the app.use (...) in the req object there is no such property because this middleware is Vitaly
  • Why do you need him? Just req.route is considered to select a path handler, which is not necessary to know at the time of executing the code inside app.use() , judging by the fact that it is not there. - Aleksei Zabrodskii

0