Answer the question
In order to leave comments, you need to log in
[express] Get all routes in readable format
There was an idea to generate documentation on request to the server.
Express 4 renders all routes in this way:
app._router.stack
It turns out rather unreadable. Is there a way to get the routes as the same character strings as I set them?
GET '/user:id'
POST '/post/new'
something like that.
Answer the question
In order to leave comments, you need to log in
Try this
View
Get
for(var i = 0; i < router.stack.length; i++) {
console.log(router.stack[i].route.path);
// здесь ваша обработка роутов
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question