Created
October 14, 2021 09:13
-
-
Save stefanocudini/a30445a21927a37ee18cf209be8beba8 to your computer and use it in GitHub Desktop.
expressjs list of defined entrypoint in app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function availableRoutes() { | |
return app._router.stack | |
.filter(r => r.route) | |
.map(r => { | |
return { | |
method: Object.keys(r.route.methods)[0], | |
path: r.route.path | |
}; | |
}); | |
} |
very short version:
console.log( app._router.stack.filter(r => r.route).map(r => `${Object.keys(r.route.methods)[0]} ${r.route.path}`) )
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
short version: