init.js
This file
Path
lib/middleware/init.js
26 lines · 570 bytes · JavaScript
Last changed by
Merge pull request #2004 from agchou/clean-up-codeJonathan Ongbefore adoption0120874
History of this fileTake it
The walk stopped after 200 commits: lines older than e367463 point at it.
4.0.0-rc4Roman Shtylmanbefore adoptione367463
lines 1–23why, one step back1/**2 * Initialization middleware, exposing the3 * request and response to eachother, as well4 * as defaulting the X-Powered-By header field.5 *6 * @param {Function} app7 * @return {Function}8 * @api private9 */1011exports.init = function(app){12 return function expressInit(req, res, next){13 if (app.enabled('x-powered-by')) res.setHeader('X-Powered-By', 'Express');14 req.res = res;15 res.req = req;16 req.next = next;1718 req.__proto__ = app.request;19 res.__proto__ = app.response;2021 res.locals = res.locals || Object.create(null);2223 next();Merge pull request #2004 from agchou/clean-up-codeJonathan Ongbefore adoption0120874
line 24why, one step back24 };4.0.0-rc4Roman Shtylmanbefore adoptione367463
lines 25–26why, one step back25};26