diff --git a/lib/router.js b/lib/router.js index e19d7dd..788118e 100644 --- a/lib/router.js +++ b/lib/router.js @@ -16,6 +16,7 @@ 'use strict'; var Route = require('./route'); +var helpers = require('./helpers'); function regexEscape(s) { return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); @@ -83,6 +84,11 @@ Router.prototype.add = function(method, path, handler, options) { var routeMap = methodMap.get(method); var regExp = route.regexp || route.fullUrlRegExp; + + if (routeMap.has(regExp.source)) { + helpers.debug('"' + path + '" resolves to same regex as existing route.'); + } + routeMap.set(regExp.source, route); };