Skip to content
Myr

Added hook()

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

authored by visionmedia · committed by visionmedia · parent bd5e771 · Browse files · 2 files+24 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+24 added−2 removed

  • tests:+13 added−0 removed
  • other:+11 added−2 removed

2 files+24 added−2 removed

modified:lib/express.core.js+11 added-2 removed
25 unmodified lines
26 }27 }28 },29 30 hookCallbacks : {},31 32 hook : function(name) {33 for (var name in this.hookCallbacks)34 if (this.hookCallbacks.hasOwnProperty(name))35 for (i = 0, len = this.hookCallbacks[name].length; i < len; ++i)36 this.hookCallbacks[name][i].apply(this, this.argsArray(arguments, 1))37 },38 39 /**40 * Start express, binding to _port_.41 *42 * @param {int} port
1 unmodified line
44 */45 46 start : function(port) {47 this.server.listen(port || 3000, function(request, response){39 // TODO: middleware48 Express.request = request49 Express.hook('request')50 request.headers = Express.arrayToHash(request.headers)51 request.cookie = Express.parseCookie(request.headers['Cookie'])52 request.uri.params = Express.parseNestedParams(request.uri.params)53 request.uri.path = Express.normalizePath(request.uri.path)44 Express.request = request54 Express.response.cookie = request.cookie55 Express.response.body = Express.callRouteFor(request)56 Express.prepareCookie()57 response.sendHeader(Express.response.status, Express.hashToArray(Express.response.headers))
451 unmodified lines
modified:spec/spec.core.js+13 added