express throws error as `body-parser deprecated undefined extended`

后端 未结 6 2126
囚心锁ツ
囚心锁ツ 2020-12-23 08:29

In my node app, I am using express. all works fine, But i am getting error in the cmd. I use all are updated modules...

my code :

6条回答
  •  不知归路
    2020-12-23 09:31

    You have to explicitly set extended for bodyParser.urlencoded() since the default value is going to change in the next major version of body-parser. Example:

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

    Since express 4.16.0, you can also do:

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

提交回复
热议问题