Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Avoid duplicate routes, fixes #12
Browse files Browse the repository at this point in the history
  • Loading branch information
wibblymat committed Dec 17, 2014
1 parent 66eef5e commit 171c397
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ Router.prototype.any = function(path, handler) {
};

Router.prototype.add = function(method, path, handler) {
method = method.toLowerCase();
var route = new Route(method, path, handler);
this.routes[method] = this.routes[method] || {};
this.routes[method][path] = new Route(method.toLowerCase(), path, handler);
this.routes[method][route.regexp.toString()] = route;
};

Router.prototype.matchMethod = function(method, url) {
Expand Down

0 comments on commit 171c397

Please sign in to comment.