Created
February 16, 2022 15:55
-
-
Save simonista/d2d3f7f57cbc6ed7b63b4fbe1f116b98 to your computer and use it in GitHub Desktop.
Revisions
-
simonista created this gist
Feb 16, 2022 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ function printRoutePaths(router, prefix) { router.stack.forEach(function(r){ if (r.route?.path){ for (let key in r.route.methods) { if (r.route.methods[key]) { console.log(`${key.toUpperCase()} ${prefix}${r.route.path}`) } } } else if (r.name === 'router') { let newPrefix = r.regexp.toString().replace('/^\\', '').replace('\\/?(?=\\/|$)/i', '') printRoutePaths(r.handle, `${prefix}${newPrefix}`) } }) }