12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- 'use strict';
- var setPrototyeOf = require('setprototypeof')
- 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;
- setPrototyeOf(req, app.request)
- setPrototyeOf(res, app.response)
- res.locals = res.locals || Object.create(null);
- next();
- };
- };
|