Created
June 21, 2014 03:09
-
-
Save e7h4n/94afa56f1a1cd020c7e8 to your computer and use it in GitHub Desktop.
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
var ignoreRegexp = ['/^\\/?(?=/|$)/i', '/^(.*)\\/?$/i', '/^\\/ss\\/?(?=/|$)/i']; | |
var routerProto = express.Router().__proto__; | |
var regexpList = app._router.stack.reduce(function findProto(memo, curr) { | |
if (ignoreRegexp.indexOf(curr.regexp.toString()) === -1) { | |
memo.push(curr.regexp); | |
} | |
if (curr.handle.__proto__ === routerProto && curr.handle.stack) { | |
memo = curr.handle.stack.reduce(findProto, memo); | |
} | |
return memo; | |
}, []); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment