Skip to content
Myr

Asynchronous handlers working.

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

authored by csausdev · committed by csausdev · parent 0a911dd · Browse files · 4 files+23 added−18 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+23 added−18 removed

  • tests:+1 added−0 removed
  • other:+22 added−18 removed

4 files+23 added−18 removed

modified:examples/simple.js+1 added-1 removed
modified:lib/express.core.js+17 added-8 removed
249 unmodified lines
250 Express.home = Express.settings.basepath251 Express.response.body = null252 Express.response.status = 200253 Express.request = request254 Express.originalResponse = response255 request.headers = Express.arrayToHash(request.headers)256 request.uri.params = Express.parseNestedParams(request.uri.params)257 request.uri.path = Express.normalizePath(request.uri.path)258 Express.hook('onRequest')259 try { Express.response.body = Express.callRouteFor(request) }260 catch (e) { Express.fail(e) }260 Express.hook('onResponse')261 response.sendHeader(Express.response.status, Express.hashToArray(Express.response.headers))262 response.sendBody(Express.response.body || '')263 response.finish()261 262 if (Express.response.body) {263 Express.server.finished()264 }265 })265 }266 },267 268 finished: function(body) {269 if (body) Express.response.body = body270 Express.hook('onResponse')271 Express.originalResponse.sendHeader(Express.response.status, Express.hashToArray(Express.response.headers))272 Express.originalResponse.sendBody(Express.response.body || '')273 Express.originalResponse.finish()274 }275 276 },277 278 /**279 * Fail Express with exception _e_.
373 unmodified lines
653 if (route.keys)654 for (var i = 0, len = route.keys.length; i < len; ++i) 655 this.request.uri.params[route.keys[i]] = Express.captures[i+1] || null656 var body = this.eval(Express.contentsOf(route.callback))647 if (typeof body != 'string') 648 throw "route `" + route.method.toUpperCase() + ' ' + route.path + "' must return a string"657 if (typeof body != 'string') body = null658 return body659 },660 661 /**653 * Attemp to find and return a route matching _request_.662 * Attempt to find and return a route matching _request_.663 *664 * @param {object} request665 * @return {object}666 * @api private
68 unmodified lines
modified:spec/spec.node.js+1 added
modified:Readme.md+4 added-9 removed