Skip to content
Myr

Added "helpful 404" support page

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

authored by visionmedia · committed by visionmedia · parent 6642c4c · Browse files · 5 files+28 added−10 removed
This commit

State

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

Diff stats

5 files+28 added−10 removed

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

5 files+28 added−10 removed

modified:examples/app.js+1 added
modified:lib/express/pages/not-found.js+8 added-6 removed
modified:lib/express/pages/style.js+12 added-1 removed
modified:lib/express/core.js+6 added-1 removed
133 unmodified lines
134 135 route: function(request){136 this.request = request137 var route = this.matchingRoute()138 return route ? route.run(this.captures.slice(1)) : halt()138 if (route)139 return route.run(this.captures.slice(1))140 else if (accepts('html') && set('helpful 404'))141 halt(404, require('express/pages/not-found').render())142 else143 halt()144 },145 146 /**147 * Attempt to match a route from Express.routes.
163 unmodified lines
modified:spec/spec.routing.js+1 added-2 removed
170 unmodified lines
171 describe 'with an unmatchable request path'172 describe 'with "helpful 404" enabled'173 it 'should show the help html'174 enable('helpful 404')175 get('/something').status.should.eql 500175 get('/something').status.should.eql 404176 get('/something').body.should.include('<h1>Express</h1>')177 get('/something').body.should.include('<h2><em>404</em> Not Found</h2>')178 get('/something').body.should.include("get('/something'")178 end179 end180 181 describe 'with "helpful 404" disabled'
54 unmodified lines