Tôi đang cố gửi khách hàng đến trang tiếp theo khi quá trình đăng nhập được thực hiện thành công, trang xác nhận trang. Nhưng tôi đang gặp phải một số lỗi. image screenshotCách chuyển hướng trang khác sau khi đăng nhập thành công nodejs
router.post('/sign_in', urlend, function(req, res) {
var email = req.body.user_id;
var password = req.body.password;
if (email != '' && password != '') {
user_modell.findOne({
email: email,
password: password
}, function(err, data) {
if (err) {
//res.status(500).send();
console.log('error');
} else if (!data) {
console.log('Incorrect User ID or Password');
return res.end();
} else {
res.render("confirm");
}
});
}
res.end();
});
return res.redirect ('/ HomePage'); – Lalit
Đã được trả lời ở đây https://stackoverflow.com/questions/36434978/how-to-redirect-to-another-page-in-node-js – Lalit
sir tôi đã làm điều này, vui lòng tham khảo ảnh chụp màn hình được đính kèm trong câu hỏi. tôi đang phải đối mặt với các sự kiện lỗi unhanded, trong khi tôi đang sử dụng res parameeter. –