Skip to content
Myr

Implemented route middleware support

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 8a845e2 · Browse files · 2 files+17 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+17 added−1 removed

  • other:+17 added−1 removed

2 files+17 added−1 removed

modified:examples/auth/app.js+6 added-1 removed
modified:lib/express/server.js+11 added
305 unmodified lines
306// Generate routing methods307308(function(method){309 Server.prototype[method] = function(path, fn){310 // Ensure router is mounted311 if (!this.__usedRouter) {312 this.use(this.router);313 }314315 // Route specific middleware support316 if (arguments.length > 2) {317 for (var i = 1, len = arguments.length - 1; i < len; ++i) {318 this[method](path, arguments[i]);319 }320 fn = arguments[arguments.length - 1];321 }322323 // Generate the route324 this.routes[method](path, fn);325 return this;326 };327 return arguments.callee;
1 unmodified line