middleware.js
This file
Path
lib/middleware.js
36 lines · 736 bytes · JavaScript
Last changed by
restore req/res protoTJ Holowaychukbefore adoption58d522d
History of this fileTake it
The walk stopped after 200 commits: lines older than bb56a09 point at it.
Added `app.all()` testTj Holowaychukbefore adoptionbb56a09
lines 1–2why, one step back12/*!update headersTJ Holowaychukbefore adoptiona376980
line 3why, one step back3 * Express - middlewareAdded `app.all()` testTj Holowaychukbefore adoptionbb56a09
lines 4–18why, one step back4 * Copyright(c) 2010-2011 TJ Holowaychuk <tj@vision-media.ca>5 * MIT Licensed6 */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){Merge branch 'master' of github.com:visionmedia/expressTJ Holowaychukbefore adoptionc4e0035
line 19why, one step back19 return function expressInit(req, res, next){Added `app.all()` testTj Holowaychukbefore adoptionbb56a09
line 20why, one step back20 req.app = res.app = app;make expressInit() middleware self-awareTJ Holowaychukbefore adoptionb0e03eb
line 21why, one step back21 res.setHeader('X-Powered-By', 'Express');Added `app.all()` testTj Holowaychukbefore adoptionbb56a09
lines 22–36why, one step back22 req.res = res;23 res.req = req;24 req.next = next;2526 req.__proto__ = app.request;27 res.__proto__ = app.response;2829 res.locals = function(obj){30 for (var key in obj) res.locals[key] = obj[key];31 return res;32 };3334 next();35 }36};