我的表单具有以下操作
<form action="users/edit/profile/{{user._id}}" method="post">
route.js
router.post('/edit/profile/:id', controllers.updateUserProfile);
和控制器
updateUserProfile: function(req, res){
User.findByIdAndUpdate(req.params.id, { $set: { username: req.body.username, email: req.body.email, first_name: req.body.first_name, last_name: req.body.last_name }}, function (err, user) {
if (err) {
console.log(err);
res.render("editProfile", {user: req.body});
}
res.redirect("/users/me/");
});
},