0
//在routes.jsREQ從下一()
test = require('test');
app.get('/test', function(req, res) {
test.first(
req,res,
test.second,
'info'
);
});
//在test.js
exports.first= function(req, res, next, inf){
req.test= inf;
console.log(inf); //info
next();
};
exports.second= function(req, res, next){
console.log(req); //undefined
res.jsonp(req.test);//error :s
};
這是從how to call a controller with express routes and include a defined parameter
你在哪裏叫第二? – mithunsatheesh 2014-10-06 17:09:04
在test.first – coiso 2014-10-06 17:09:56
的下一個()中,究竟在上面的代碼中? – mithunsatheesh 2014-10-06 17:11:10