router.post("/api/login",async function(req,res){
// if there is a matching user...
if (user) {
res.sendStatus(204);
console.log("204 triggered");
}
// Otherwise, if there's no matching user...
else {
// Auth fail
res.status(401).send();
console.log("401 is triggered")
}
});
<form action="./login" method="POST" class = "register">
我知道res.redirect和res.status()不能一起用,但是我需要他user验证通过后进入主页面。找了好多资料了也没有讲的。有谁知道该怎么办么?需要重新弄一个get还是post么?我其实还需要返回user 的一个token,user.token,试了res.send(user.token)也会报错