How to get all registered routes in Express?

express 3.x

Okay, found it myself … it’s just app.routes 🙂

express 4.x

Applications – built with express()

app._router.stack

Routers – built with express.Router()

router.stack

Note: The stack includes the middleware functions too, it should be filtered to get the “routes” only.

Leave a Comment