Skip to content
Myr

Added app.lookup() as app.lookup.all()

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 b33f38b · Browse files · 2 files+9 added−2 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+9 added−2 removed

  • tests:+1 added−0 removed
  • other:+8 added−2 removed

2 files+9 added−2 removed

modified:lib/http.js+8 added-2 removed
55 unmodified lines
5657app.init = function(middleware){58 var self = this;59 this.cache = {};60 this.match = {};61 this.lookup = {};60 this.settings = {};61 this.redirects = {};62 this.isCallbacks = {};63 this._locals = {};
53 unmodified lines
117 this.remove = function(url){118 return self.remove.all(url);119 };120121 this.match = function(url){122 return self.match.all(url);123 };124125 this.lookup = function(url){126 return self.lookup.all(url);127 };128129 methods.forEach(function(method){130 self.match[method] = function(url){131 return self.router.match(url, 'all' == method132 ? null
371 unmodified lines
modified:test/router.test.js+1 added
182 unmodified lines
183 app.lookup.put('/user/:id').should.have.length(1);184 app.lookup.get('/user/:id/edit').should.have.length(1);185 app.lookup.get('/').should.have.be.empty;186 app.lookup.all('/user/:id').should.have.length(2);187 app.lookup('/user/:id').should.have.length(2);188 },189190 'test app.remove': function(){191 var app = express.createServer();
53 unmodified lines