dox-foundation-demo node_modules/express/node_modules/connect/lib/connect.js

EventEmitter

declaration
EventEmitter

    Description

    Module dependencies.

    Source

    var EventEmitter = require('events').EventEmitter
      , proto = require('./proto')
      , utils = require('./utils')
      , path = require('path')
      , basename = path.basename
      , fs = require('fs');
    
    // node patches
    
    require('./patch');
    
    // expose createServer() as the module
    
    exports = module.exports = createServer;

    version

    property
    exports.version

      Description

      Framework version.

      Source

      exports.version = '2.7.11';

      mime

      property
      exports.mime

        Description

        Expose mime module.

        Source

        exports.mime = require('./middleware/static').mime;

        proto

        property
        exports.proto

          Description

          Expose the prototype.

          Source

          exports.proto = proto;

          middleware

          property
          exports.middleware

            Description

            Auto-load middleware getters.

            Source

            exports.middleware = {};

            createServer

            function
            createServer()
            • @return: {Function}

            Description

            Create a new connect server.

            Source

            function createServer() {
              function app(req, res, next){ app.handle(req, res, next); }
              utils.merge(app, proto);
              utils.merge(app, EventEmitter.prototype);
              app.route = '/';
              app.stack = [];
              for (var i = 0; i < arguments.length; ++i) {
                app.use(arguments[i]);
              }
              return app;
            };

            createServer

            property
            createServer.createServer

              Description

              Support old .createServer() method.

              Source

              createServer.createServer = createServer;

                Description

                Auto-load bundled middleware with getters.

                Source

                fs.readdirSync(__dirname + '/middleware').forEach(function(filename){
                  if (!/\.js$/.test(filename)) return;
                  var name = basename(filename, '.js');
                  function load(){ return require('./middleware/' + name); }
                  exports.middleware.__defineGetter__(name, load);
                  exports.__defineGetter__(name, load);
                });