Skip to content
Myr

init.js

This file

Path

lib/middleware/init.js

36 lines · 752 bytes · JavaScript

Last changed by

perf: enable strict modeDouglas Christopher Wilsonbefore adoptione71014f

History of this file

Take it

The walk stopped after 200 commits: lines older than 6bc7574 point at it.

docs: add license commentsDouglas Christopher Wilsonbefore adoption95ad276

lines 1–8why, one step back
1/*!
2 * express3 * Copyright(c) 2009-2013 TJ Holowaychuk4 * Copyright(c) 2013 Roman Shtylman5 * Copyright(c) 2014-2015 Douglas Christopher Wilson6 * MIT Licensed7 */8

perf: enable strict modeDouglas Christopher Wilsonbefore adoptione71014f

lines 9–10why, one step back
9'use strict';
10

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

lines 11–12why, one step back
11/**
12 * Initialization middleware, exposing the

Fix typo in commentSung Kimbefore adoption4070dab

line 13why, one step back
13 * request and response to each other, as well

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

lines 14–36why, one step back
14 * as defaulting the X-Powered-By header field.
15 *16 * @param {Function} app17 * @return {Function}18 * @api private19 */2021exports.init = function(app){22 return function expressInit(req, res, next){23 if (app.enabled('x-powered-by')) res.setHeader('X-Powered-By', 'Express');24 req.res = res;25 res.req = req;26 req.next = next;2728 req.__proto__ = app.request;29 res.__proto__ = app.response;3031 res.locals = res.locals || Object.create(null);3233 next();34 };35};36