Created
October 7, 2016 23:12
-
-
Save sheeley/091be310d327097de26f99fe614d9b66 to your computer and use it in GitHub Desktop.
restify list routes by path
This file contains 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
const output = {} | |
for (const verb of Object.keys(server.router.routes)) { | |
console.log(verb) | |
for (const route of server.router.routes[verb]) { | |
const {method, spec: {path}} = route | |
if (!output[path]) { | |
output[path] = [] | |
} | |
output[path].push(method) | |
} | |
} | |
console.log(output) | |
process.exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment