Skip to content
Myr

Refactored Router#route()

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

authored by visionmedia · committed by visionmedia · parent 7e2ccf7 · Browse files · 4 files+5 added−31 removed
This commit

State

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

Diff stats

4 files+5 added−31 removed

  • tests:+3 added−9 removed
  • other:+2 added−22 removed

4 files+5 added−31 removed

modified:lib/express/core.js+2 added-3 removed
129 unmodified lines
130 */131 132 route: function(request){133 this.request = request134 return this.matchingRoute().run()134 var route = this.matchingRoute()135 return route ? route.run() : halt()136 },137 138 /**139 * Attempt to match a route from Express.routes.139 * Failure to do so will throw a NotFoundError.140 *141 * @return {Route}142 * @api private143 */
1 unmodified line
145 matchingRoute: function(){146 for (var i = 0, len = Express.routes.length; i < len; ++i)147 if (this.match(Express.routes[i]))148 return Express.routes[i]149 notFound()149 },150 151 /**152 * Check if _route_ matches the current request.
118 unmodified lines
modified:lib/express/exceptions.js-9 removed
modified:lib/express/helpers.js-10 removed
157 unmodified lines
158 throw new InvalidStatusCode(code)159}160161/**162 * Throw NotFoundError in context to the current request.163 *164 * @api public165 */166167exports.notFound = function() {168 throw new NotFoundError(Express.server.request)169}170171/**162 * Escape special characters in _html_.163 *164 * @param {string} html165 * @return {string}
85 unmodified lines
modified:spec/spec.core.routing.js+3 added-9 removed