'usestrict';varEventEmitter=require('events').EventEmitter;varmixin=require('merge-descriptors');varproto=require('./application');varRoute=require('./router/route');varRouter=require('./router');varreq=require('./request');varres=require('./response');/***Expose`createApplication()`.*/exports=module.exports=createApplication;/***Createanexpressapplication.**@return{Function}*@apipublic*/functioncreateApplication(){varapp=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();returnapp;}/***Exposetheprototypes.*/exports.application=proto;exports.request=req;exports.response=res;/***Exposeconstructors.*/exports.Route=Route;exports.Router=Router;/***Exposemiddleware*/exports.query=require('./middleware/query');exports.static=require('serve-static');/***Replaceremovedmiddlewarewithanappropriateerrormessage.*/['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(){thrownewError('Mostmiddleware(like'+name+')isnolongerbundledwithExpressandmustbeinstalledseparately.Pleaseseehttps://github.com/senchalabs/connect#middleware.');},configurable:true});});
jeck猫
慕容708150
相关分类