0
我想從node.js重新渲染一個jade以設置錯誤消息。 我收到錯誤「發送後無法設置標題」。Node.js登錄表單渲染:錯誤發送後無法設置標題
這是我的代碼...
app.post('/login', function (req, res) {
checkUserAndPassword(req.body.mail, req.body.password, function (status) {
console.log(status);
if (status === 1) {
getInstances(function (instances) {
res.render('mainSite', {title: "Systemverwaltung - Übersicht", instances: instances});
});
} else {
res.render('index', {title: "Systemverwaltung", error: "Wrong Mail or Password!"});
}
});
});
有沒有人的想法?
可能重複的[錯誤:發送到客戶端後無法設置標頭](https://stackoverflow.com/questions/7042340/error-cant-set-headers-after-they-are-sent -to-的客戶端) –