annotate node_modules/express/lib/express.js @ 101:52e44ee1c791 tip master

enabled all scores in autostart script
author Rob Canning <rc@kiben.net>
date Tue, 21 Apr 2015 16:20:57 +0100
parents 0c3a2942ddee
children
rev   line source
rc@73 1 /**
rc@73 2 * Module dependencies.
rc@73 3 */
rc@73 4
rc@73 5 var EventEmitter = require('events').EventEmitter;
rc@73 6 var mixin = require('utils-merge');
rc@73 7 var proto = require('./application');
rc@73 8 var Route = require('./router/route');
rc@73 9 var Router = require('./router');
rc@73 10 var req = require('./request');
rc@73 11 var res = require('./response');
rc@73 12
rc@73 13 /**
rc@73 14 * Expose `createApplication()`.
rc@73 15 */
rc@73 16
rc@73 17 exports = module.exports = createApplication;
rc@73 18
rc@73 19 /**
rc@73 20 * Create an express application.
rc@73 21 *
rc@73 22 * @return {Function}
rc@73 23 * @api public
rc@73 24 */
rc@73 25
rc@73 26 function createApplication() {
rc@73 27 var app = function(req, res, next) {
rc@73 28 app.handle(req, res, next);
rc@73 29 };
rc@73 30
rc@73 31 mixin(app, proto);
rc@73 32 mixin(app, EventEmitter.prototype);
rc@73 33
rc@73 34 app.request = { __proto__: req, app: app };
rc@73 35 app.response = { __proto__: res, app: app };
rc@73 36 app.init();
rc@73 37 return app;
rc@73 38 }
rc@73 39
rc@73 40 /**
rc@73 41 * Expose the prototypes.
rc@73 42 */
rc@73 43
rc@73 44 exports.application = proto;
rc@73 45 exports.request = req;
rc@73 46 exports.response = res;
rc@73 47
rc@73 48 /**
rc@73 49 * Expose constructors.
rc@73 50 */
rc@73 51
rc@73 52 exports.Route = Route;
rc@73 53 exports.Router = Router;
rc@73 54
rc@73 55 /**
rc@73 56 * Expose middleware
rc@73 57 */
rc@73 58
rc@73 59 exports.query = require('./middleware/query');
rc@73 60 exports.static = require('serve-static');
rc@73 61
rc@73 62 /**
rc@73 63 * Replace removed middleware with an appropriate error message.
rc@73 64 */
rc@73 65
rc@73 66 [
rc@73 67 'json',
rc@73 68 'urlencoded',
rc@73 69 'bodyParser',
rc@73 70 'compress',
rc@73 71 'cookieSession',
rc@73 72 'session',
rc@73 73 'logger',
rc@73 74 'cookieParser',
rc@73 75 'favicon',
rc@73 76 'responseTime',
rc@73 77 'errorHandler',
rc@73 78 'timeout',
rc@73 79 'methodOverride',
rc@73 80 'vhost',
rc@73 81 'csrf',
rc@73 82 'directory',
rc@73 83 'limit',
rc@73 84 'multipart',
rc@73 85 'staticCache',
rc@73 86 ].forEach(function (name) {
rc@73 87 Object.defineProperty(exports, name, {
rc@73 88 get: function () {
rc@73 89 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.');
rc@73 90 },
rc@73 91 configurable: true
rc@73 92 });
rc@73 93 });