Skip to content
Myr

Added redirect(home) and settings.basepath [#8]

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

authored by visionmedia · committed by visionmedia · parent 08c8219 · Browse files · 2 files+25 added−4 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+25 added−4 removed

  • tests:+11 added−0 removed
  • other:+14 added−4 removed

2 files+25 added−4 removed

modified:lib/express.core.js+14 added-4 removed
19 unmodified lines
20 headers : {},21 cookie : {}22 },23 24 // --- Defaults24 // --- Settings25 26 defaults : {26 settings : {27 basepath : '/',28 29 cookie : {30 maxAge : 360031 },30 route : {32 33 defaultRoute : {34 callback : function() {35 Express.respond('Page or file cannot be found', 'Not Found')36 }37 }38 },39 40 hookCallbacks : {41 request : [42 43 // Redirect helpers44 45 function (request, response) { 46 Express.home = Express.settings.basepath47 },48 49 // Cookie parsing50 51 function (request, response) {52 Express.response.cookie = request.cookie = Express.parseCookie(request.headers['Cookie'])
73 unmodified lines
126 * @api private127 */128 129 callback : function(request, response){130 Express.home = Express.settings.basepath131 Express.response.body = null132 Express.response.status = 200133 Express.request = request134 request.headers = Express.arrayToHash(request.headers)
368 unmodified lines
503 * @api private504 */505 506 callRouteFor : function(request) {497 var route = this.findRouteFor(request) || this.defaults.route507 var route = this.findRouteFor(request) || this.settings.defaultRoute508 if (route.keys)509 for (i = 0, len = route.keys.length; i < len; ++i) 510 this.request.uri.params[route.keys[i]] = Express.captures[i+1] || null511 return this.eval(Express.contentsOf(route.callback)).toString()
84 unmodified lines
modified:spec/spec.core.js+11 added