middleware.js
This file
Path
lib/middleware.js
32 lines · 633 bytes · JavaScript
Last changed by
Merge pull request #1650 from printercu/masterTJ Holowaychukbefore adoptionaec3428
History of this fileTake it
The walk stopped after 200 commits: lines older than 496ee40 point at it.
Merge branch 'master' of github.com:visionmedia/expressTJ Holowaychukbefore adoption496ee40
lines 1–19why, one step back12/**3 * Module dependencies.4 */56var utils = require('./utils');78/**9 * Initialization middleware, exposing the10 * request and response to eachother, as well11 * as defaulting the X-Powered-By header field.12 *13 * @param {Function} app14 * @return {Function}15 * @api private16 */1718exports.init = function(app){19 return function expressInit(req, res, next){change prev commit to use app.enabled()TJ Holowaychukbefore adoption8beb1f2
line 20why, one step back20 if (app.enabled('x-powered-by')) res.setHeader('X-Powered-By', 'Express');Merge branch 'master' of github.com:visionmedia/expressTJ Holowaychukbefore adoption496ee40
lines 21–32why, one step back21 req.res = res;22 res.req = req;23 req.next = next;2425 req.__proto__ = app.request;26 res.__proto__ = app.response;2728 res.locals = res.locals || utils.locals(res);2930 next();31 }32};