我有以下功能我一直得到error: uncaughtException: Cannot call method 'redirect' of undefined
res.redirect即將寫在server.js爲未定義
function(req, res) {
async.waterfall([
function(next){
next(null, res);
},
function(next){
next(null, res);
},
function(next, res){
res.redirect('www.google.com')
}
]);
}
使得從上面的回答下面我得到改變之後,錯誤如下:
2014-09-04T13:56:08.678Z - error: uncaughtException: Object function (err) {
if (err) {
callback.apply(null, arguments);
callback = function() {};
}
else {
var args = Array.prototype.slice.call(arguments, 1);
var next = iterator.next();
if (next) {
args.push(wrapIterator(next));
}
else {
args.push(callback);
}
async.nextTick(function() {
iterator.apply(null, args);
});
}
} has no method 'send'
您是否將'res'傳遞給函數? – loveNoHate 2014-09-04 12:07:06
我的函數寫得和上面一樣 – jyoti 2014-09-04 12:07:49
你是否通過從'.createServer'傳遞'res'來調用匿名函數?或者它在另一個函數中? – loveNoHate 2014-09-04 15:24:51