这是我的简单 form.html :
<form id="login-form" action=" ?? " method="post">Email
<br/>
<input type="text" name="Email" id="em" />
<br/>password
<br/>
<input type="text" name="password" id="pas" />
<br/>
<br/>
<br/>
<input type="submit" value="Submit" />
</form>
这是我的 express node.js 代码 app.js:
app.post('/form', passport.authenticate('local-login', {
failureFlash: true // allow flash messages
}),
function (req, res) {
console.log("hello");
if (req.body.remember) {
req.session.cookie.maxAge = 1000 * 60 * 3;
} else {
req.session.cookie.expires = false;
}
res.redirect('/');
});
当我在 action 属性中编写 app.js 路径“our-project/app.js”并提交表单时,没有任何响应。form.html 路径“我们的项目/form/form.html”