If I had defined a bunch of routes and wanted to get the total number of routes setup at any point, how would I do this?
I cannot put a counter inside each route as they are spread out though-out the application. I am looking to do this via the Express.js API. I have had a look though the documentation but was unable to find anything.
Depends on Express version
3.x
console.log(app.routes.length);
4.x
console.log(app._router.stack.length);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.