我一直没搞明白这段代码和表单隐藏域的关系,哪位大侠详细解释下
app.post('/admin/movie/new',function(req,res){
var id = req.body.movie._id
console.log('提交:'+id)
var movieObj = req.body.movie
var _movie
if (id !== 'undefined') {
Movie.findById(id,function(err,movie){
if (err) {
console.log(err)
}
_movie = _.extend(movie,movieObj)
_movie.save(function(err,movie){
if (err) {
console.log(err)
}
res.redirect('/movie/'+movie._id)
})
})
}
和
form.form-horizontal(method="post",action="/admin/movie/new")
input(type="hidden",name="movie[_id]",value="#{movie._id}")