-1
接下来的一些教程会提供一个代码,其中使用了req.body。它是一个中间件(body-Parser)?可以查看我使用req.body的注释。为什么我们在创建任何模型时使用req.body?
Review.create({
title : req.body.title, //here it is used!!
description : req.body.description,
rating: req.body.rating,
done : false
}, function(err, review) {
if (err)
res.send(err);
如果它是第三方中间件,那它在代码中的功能如何?
https://nodejs.org/en/docs/guides/anatomy-of-an-http-transaction/,https://expressjs.com/en/api.html#req.body – tomtom
这就是为什么我们有代码的文档。 :) – Qix
@tomtom你的链接帮助很多谢谢多 – Aditya