我发现400 HTTP错误是带语法的东西,但我发现我的语法没有任何问题,有人可以帮忙看一下吗?
<!- My form view-->
<h3>Login</h3>
<form action="/home/login" method="post">
Enter your usernmae: <input type="text" name="user" value=""><br>
Enter your password: <input type="password" name="pwd" value=""><br>
<input type="submit" name="enter" value="Enter">
</form>
//controller added to my app.js
app.use('/home', indexController);
//in router.js
var passport = require('passport');
var LocalStrategy = require('passport-local').Strategy;
router.post('/login', passport.authenticate('local'), function(req, res) {
req.session.save(function (err) {
if (err) {
return next(err);
}
res.redirect('/home/' + req.user.user);
});
});