这意味着自2014年6月19日起,不赞成使用
bodyParser()
构造函数 。
app.use(bodyParser()); //Now deprecated
您现在需要分别调用方法
app.use(bodyParser.urlenpred());app.use(bodyParser.json());
等等。
如果仍然收到警告,则
urlenpred需要使用
app.use(bodyParser.urlenpred({ extended: true}));在
extended现在的配置对象的关键需要明确的被传递,因为它现在已经没有默认值。
如果您使用的快递> = 4.16.0,身体解析器已根据这些方法重新加入
express.json()和
express.urlenpred()。



