@bornkiller
2014-08-07T14:18:20.000000Z
字数 1182
阅读 2607
javascript
V2.19.6
.(2014/08/07)
base: [
'./',
'./libs/jquery',
'./libs/requirejs',
'./libs/requirejs-plugin',
]
var middleware;
if (options.middleware instanceof Array) {
middleware = options.middleware;
} else {
middleware = createDefaultMiddleware.call(this, connect, options);
if (typeof(options.middleware) === 'function') {
middleware = options.middleware.call(this, connect, options, middleware);
}
}
middleware: function(connect, options, middlewares) {
middlewares.unshift(function(req, res, next) {
var stubUrl = {
"/user/info": {
"name": "jason",
"age": 23
},
"user/login": {
"authority" : true
}
};
if(!stubUrl.hasOwnProperty(req.url)) {
return next();
}
res.end(JSON.stringify(stubUrl[req.url]));
});
return middlewares;
}
normalize
: function(name,normalize) load
: function(name, req, load, config)