Skip to content

Commit

Permalink
Merge pull request #6 from mila-labs/express-3.x
Browse files Browse the repository at this point in the history
Backward compatibility with express 3.x
  • Loading branch information
dizlexik committed Sep 4, 2014
2 parents ef25a8a + 257aa97 commit 7edc319
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ function augmentVerbs(app) {
var ret = _fn.apply(this, args);

if (!app._namedRoutes) app._namedRoutes = {};
app._namedRoutes[name] = this.route(args[0]);
app._namedRoutes[name] = (typeof this.route !== 'string')
? this.route(args[0]) // express 4.x
: this.routes[method].slice(-1)[0]; // express 3.x

return ret;
};
Expand Down

0 comments on commit 7edc319

Please sign in to comment.