為什么安裝了body-parser還無(wú)法獲得name,deadline,content這三個(gè)變量?
總報(bào)錯(cuò)說(shuō):
TypeError: Cannot destructure property `name` of 'undefined' or 'null'.
總報(bào)錯(cuò)說(shuō):
TypeError: Cannot destructure property `name` of 'undefined' or 'null'.
2020-03-25
舉報(bào)
2020-03-26
//?按照官方文檔 //?1.?npm?install?body-parser?-S //?2.?引入??在app.js中 const?bodyParser?=?require('body-parser'); //?3.?放入中間件 app.use(bodyParser.json()); app.use(bodyParser.urlencoded({extended:?true}); //?4.發(fā)送請(qǐng)求的時(shí)候?可以使用?urlencoded?格式 //?5.如果發(fā)送的是json,那么需要加入header? Content-Type:?application/json