Mercurial > hg > nodescore
view node_modules/express/lib/middleware/init.js @ 73:0c3a2942ddee
now using express to server static content
author | Rob Canning <rc@kiben.net> |
---|---|
date | Sun, 29 Jun 2014 12:11:51 +0000 |
parents | |
children |
line wrap: on
line source
/** * Initialization middleware, exposing the * request and response to eachother, as well * as defaulting the X-Powered-By header field. * * @param {Function} app * @return {Function} * @api private */ exports.init = function(app){ return function expressInit(req, res, next){ if (app.enabled('x-powered-by')) res.setHeader('X-Powered-By', 'Express'); req.res = res; res.req = req; req.next = next; req.__proto__ = app.request; res.__proto__ = app.response; res.locals = res.locals || Object.create(null); next(); }; };