Sha256: 2d4f38e65730c7006656b4e8ae09f019f9209662facb9fb0cdf6a7f6c6447963

Contents?: true

Size: 1.91 KB

Versions: 15

Compression:

Stored size: 1.91 KB

Contents

/*!
 * express
 * Copyright(c) 2009-2013 TJ Holowaychuk
 * Copyright(c) 2013 Roman Shtylman
 * Copyright(c) 2014-2015 Douglas Christopher Wilson
 * MIT Licensed
 */

'use strict';

/**
 * Module dependencies.
 */

var EventEmitter = require('events').EventEmitter;
var mixin = require('merge-descriptors');
var proto = require('./application');
var Route = require('./router/route');
var Router = require('./router');
var req = require('./request');
var res = require('./response');

/**
 * Expose `createApplication()`.
 */

exports = module.exports = createApplication;

/**
 * Create an express application.
 *
 * @return {Function}
 * @api public
 */

function createApplication() {
  var app = function(req, res, next) {
    app.handle(req, res, next);
  };

  mixin(app, EventEmitter.prototype, false);
  mixin(app, proto, false);

  app.request = { __proto__: req, app: app };
  app.response = { __proto__: res, app: app };
  app.init();
  return app;
}

/**
 * Expose the prototypes.
 */

exports.application = proto;
exports.request = req;
exports.response = res;

/**
 * Expose constructors.
 */

exports.Route = Route;
exports.Router = Router;

/**
 * Expose middleware
 */

exports.query = require('./middleware/query');
exports.static = require('serve-static');

/**
 * Replace removed middleware with an appropriate error message.
 */

[
  'json',
  'urlencoded',
  'bodyParser',
  'compress',
  'cookieSession',
  'session',
  'logger',
  'cookieParser',
  'favicon',
  'responseTime',
  'errorHandler',
  'timeout',
  'methodOverride',
  'vhost',
  'csrf',
  'directory',
  'limit',
  'multipart',
  'staticCache',
].forEach(function (name) {
  Object.defineProperty(exports, name, {
    get: function () {
      throw new Error('Most middleware (like ' + name + ') is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.');
    },
    configurable: true
  });
});

Version data entries

15 entries across 15 versions & 3 rubygems

Version Path
lanes-0.8.0 node_modules/express/lib/express.js
webpack_rails-2.0.1 lib/webpack_rails/node_modules/express/lib/express.js
webpack_rails-2.0.0 lib/webpack_rails/node_modules/express/lib/express.js
webpack_rails-1.3.1 lib/webpack_rails/node_modules/express/lib/express.js
webpack_rails-1.3.0 lib/webpack_rails/node_modules/express/lib/express.js
webpack_rails-1.2.2 lib/webpack_rails/node_modules/express/lib/express.js
webpack_rails-1.2.1 lib/webpack_rails/node_modules/express/lib/express.js
webpack_rails-1.2.0 lib/webpack_rails/node_modules/express/lib/express.js
webpack_rails-1.1.1 lib/webpack_rails/node_modules/express/lib/express.js
webpack_rails-1.1.0 lib/webpack_rails/node_modules/express/lib/express.js
webpack_rails-1.0.1 lib/webpack_rails/node_modules/express/lib/express.js
webpack_rails-1.0.0 lib/webpack_rails/node_modules/express/lib/express.js
gulp_assets-1.0.0.pre.5 template/node_modules/webpack-dev-server/node_modules/express/lib/express.js
gulp_assets-1.0.0.pre.4 template/node_modules/webpack-dev-server/node_modules/express/lib/express.js
gulp_assets-1.0.0.pre.3 template/node_modules/webpack-dev-server/node_modules/express/lib/express.js