亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

為表單添加完數據跳轉后一直報錯

TypeError: Cannot read property 'movie' of undefined
? ?at C:\imooc\app.js:82:19
? ?at Layer.handle [as handle_request] (C:\imooc\node_modules\express\lib\router\layer.js:95:5)
? ?at next (C:\imooc\node_modules\express\lib\router\route.js:137:13)
? ?at Route.dispatch (C:\imooc\node_modules\express\lib\router\route.js:112:3)
? ?at Layer.handle [as handle_request] (C:\imooc\node_modules\express\lib\router\layer.js:95:5)
? ?at C:\imooc\node_modules\express\lib\router\index.js:281:22
? ?at Function.process_params (C:\imooc\node_modules\express\lib\router\index.js:335:12)
? ?at next (C:\imooc\node_modules\express\lib\router\index.js:275:10)
? ?at serveStatic (C:\imooc\node_modules\serve-static\index.js:75:16)
? ?at Layer.handle [as handle_request] (C:\imooc\node_modules\express\lib\router\layer.js:95:5)
? ?at trim_prefix (C:\imooc\node_modules\express\lib\router\index.js:317:13)
? ?at C:\imooc\node_modules\express\lib\router\index.js:284:7
? ?at Function.process_params (C:\imooc\node_modules\express\lib\router\index.js:335:12)
? ?at next (C:\imooc\node_modules\express\lib\router\index.js:275:10)
? ?at jsonParser (C:\imooc\node_modules\body-parser\lib\types\json.js:94:7)
? ?at Layer.handle [as handle_request] (C:\imooc\node_modules\express\lib\router\layer.js:95:5)

正在回答

1 回答

命令行$ npm install?body-parser

app.js:?

var bodyParser = require('body-parser');?

app.use(bodyParser.urlencoded({ extended: true }))

路由里:

app.post('/admin/movie/new', function(res, req) {

var id = req.req.body.movie._id

var movieObj = req.req.body.movie


0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
node+mongodb 建站攻略(一期)
  • 參與學習       91828    人
  • 解答問題       921    個

帶你完整實現一個從前端到后端的項目,初中級前端開發工程師必學課程

進入課程

為表單添加完數據跳轉后一直報錯

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號