Added `app.routes`, replacing `app.routes.all()`. Closes #811
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 0ed74aa · Browse files · 1 file·+13 added−13 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+13 added−13 removed
- other:+13 added−13 removed
Provenance
- Commit
62257bc- Tree
fdd5a7e- Author
Tj Holowaychuk <tj@vision-media.ca>- Committer
Tj Holowaychuk <tj@vision-media.ca>- Parent
0ed74aa
1 file changed+13 added−13 removed
modified:lib/application.js+13 added-13 removed
49 unmodified lines50 51 // route reflection methods52 methods.forEach(function(method){53 self.lookup[method] = function(path){54- return self.routes.lookup(method, path);54+ return self._router.lookup(method, path);55 };56 57 self.match[method] = function(path){58- return self.routes.match(method, path);58+ return self._router.match(method, path);59 };60 61 self.remove[method] = function(path){62- return self.routes.lookup(method, path).remove();62+ return self._router.lookup(method, path).remove();63 };64 });65 66 // del -> delete55 unmodified lines122 next();123 });124 125 // router126- this.routes = new Router(this);127- this.routeList = this.routes.routes;126+ this._router = new Router(this);127+ this.routes = this._router.routes;128 this.__defineGetter__('router', function(){129 this.__usedRouter = true;130- return self.routes.middleware;130+ return self._router.middleware;131 });132 133 // default locals134 this.locals.settings = this.settings;12 unmodified lines147 * @api public148 */149 150 app.remove = function(path){151- return this.routes.lookup('all', path).remove();151+ return this._router.lookup('all', path).remove();152 };153 154 /**155 * Lookup routes defined with a path4 unmodified lines160 * @api public161 */162 163 app.lookup = function(path){164- return this.routes.lookup('all', path);164+ return this._router.lookup('all', path);165 };166 167 /**168 * Lookup routes matching the given `url`.3 unmodified lines172 * @api public173 */174 175 app.match = function(url){176- return this.routes.match('all', url);176+ return this._router.match('all', url);177 };178 179 /**180 * Proxy `connect.HTTPServer#use()` to apply settings to163 unmodified lines344 });345 });346 // param logic347 } else if ('function' == typeof name) {348- this.routes.param(name);348+ this._router.param(name);349 // single350 } else {351 if (':' == name[0]) name = name.substr(1);352 fns.forEach(function(fn){353- self.routes.param(name, fn);353+ self._router.param(name, fn);354 });355 }356 357 return this;141 unmodified lines499 methods.forEach(function(method){500 app[method] = function(path){501 if ('get' == method && 1 == arguments.length) return this.set(path); 502 var args = [method].concat(toArray(arguments));503- if (!this.__usedRouter) this.use(this.router);504- return this.routes._route.apply(this.routes, args);503+ if (!this.__usedRouter) this.use(this._router);504+ return this._router._route.apply(this._router, args);505 }506 });507 508 /**84 unmodified lines