Skip to content

Instantly share code, notes, and snippets.

@arn-ob
Created February 15, 2019 05:14
Show Gist options
  • Save arn-ob/07648732015af1815d9bcc49c72c9cfc to your computer and use it in GitHub Desktop.
Save arn-ob/07648732015af1815d9bcc49c72c9cfc to your computer and use it in GitHub Desktop.
function print (path, layer) {
if (layer.route) {
layer.route.stack.forEach(print.bind(null, path.concat(split(layer.route.path))))
} else if (layer.name === 'router' && layer.handle.stack) {
layer.handle.stack.forEach(print.bind(null, path.concat(split(layer.regexp))))
} else if (layer.method) {
console.log('%s /%s',
layer.method.toUpperCase(),
path.concat(split(layer.regexp)).filter(Boolean).join('/'))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment