Skip to content
Myr

express.js

This file

Path

lib/express.js

92 lines · 1.7 KiB · JavaScript

Last changed by

some jshint cleanupJonathan Ongbefore adoption5572897

History of this file

Take it

The walk stopped after 200 commits: lines older than 53b8e25 point at it.

ocdTJ Holowaychukbefore adoption53b8e25

lines 1–4why, one step back
1/**
2 * Module dependencies.3 */4

remove app.router and refactor middleware processingRoman Shtylmanbefore adoptionf41d09a

line 5why, one step back
5var EventEmitter = require('events').EventEmitter;

some jshint cleanupJonathan Ongbefore adoption5572897

line 6why, one step back
6var mixin = require('utils-merge');

use utils-merge module to mixin object propertiesRoman Shtylmanbefore adoption718e68f

line 7why, one step back
7var proto = require('./application')

ocdTJ Holowaychukbefore adoption53b8e25

lines 8–10why, one step back
8 , Route = require('./router/route')
9 , Router = require('./router')10 , req = require('./request')

some jshint cleanupJonathan Ongbefore adoption5572897

line 11why, one step back
11 , res = require('./response');

ocdTJ Holowaychukbefore adoption53b8e25

lines 12–26why, one step back
12
13/**14 * Expose `createApplication()`.15 */1617exports = module.exports = createApplication;1819/**20 * Create an express application.21 *22 * @return {Function}23 * @api public24 */2526function createApplication() {

remove app.router and refactor middleware processingRoman Shtylmanbefore adoptionf41d09a

lines 27–30why, one step back
27 var app = function(req, res, next) {
28 app.handle(req, res, next);29 };30

use utils-merge module to mixin object propertiesRoman Shtylmanbefore adoption718e68f

line 31why, one step back
31 mixin(app, proto);

remove app.router and refactor middleware processingRoman Shtylmanbefore adoptionf41d09a

lines 32–33why, one step back
32 mixin(app, EventEmitter.prototype);
33

Merge pull request #1650 from printercu/masterTJ Holowaychukbefore adoptionaec3428

lines 34–35why, one step back
34 app.request = { __proto__: req, app: app };
35 app.response = { __proto__: res, app: app };

ocdTJ Holowaychukbefore adoption53b8e25

lines 36–54why, one step back
36 app.init();
37 return app;38}3940/**41 * Expose the prototypes.42 */4344exports.application = proto;45exports.request = req;46exports.response = res;4748/**49 * Expose constructors.50 */5152exports.Route = Route;53exports.Router = Router;54

remove last pieces of connect dependencyRoman Shtylmanbefore adoption1396e08

lines 55–57why, one step back
55/**
56 * Expose middleware57 */

ocdTJ Holowaychukbefore adoption53b8e25

line 58why, one step back
58

throw errors when users try to access removed middlewareJonathan Ongbefore adoption9ea18e1

line 59why, one step back
59exports.query = require('./middleware/query');

use serve-static for static middlewareJonathan Ongbefore adoption6ec1904

line 60why, one step back
60exports.static = require('serve-static');

throw errors when users try to access removed middlewareJonathan Ongbefore adoption9ea18e1

lines 61–92why, one step back
61
62/**63 * Replace removed middleware with an appropriate error message.64 */6566[67 'json',68 'urlencoded',69 'bodyParser',70 'compress',71 'cookieSession',72 'session',73 'logger',74 'cookieParser',75 'favicon',76 'responseTime',77 'errorHandler',78 'timeout',79 'methodOverride',80 'vhost',81 'csrf',82 'directory',83 'limit',84 'multipart',85 'staticCache',86].forEach(function (name) {87 Object.defineProperty(exports, name, {88 get: function () {89 throw new Error('Most middleware is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.');90 }91 });92});