rc@73: /** rc@73: * Initialization middleware, exposing the rc@73: * request and response to eachother, as well rc@73: * as defaulting the X-Powered-By header field. rc@73: * rc@73: * @param {Function} app rc@73: * @return {Function} rc@73: * @api private rc@73: */ rc@73: rc@73: exports.init = function(app){ rc@73: return function expressInit(req, res, next){ rc@73: if (app.enabled('x-powered-by')) res.setHeader('X-Powered-By', 'Express'); rc@73: req.res = res; rc@73: res.req = req; rc@73: req.next = next; rc@73: rc@73: req.__proto__ = app.request; rc@73: res.__proto__ = app.response; rc@73: rc@73: res.locals = res.locals || Object.create(null); rc@73: rc@73: next(); rc@73: }; rc@73: }; rc@73: