How to get rid of Connect 3.0 deprecation alert?

后端 未结 3 1237
梦毁少年i
梦毁少年i 2020-12-04 14:10

I\'m a node.js developer who creates web apps using express.js. By now, my problem is:

Whenever I create an app on my computer, npm install its stuff and run it (wit

3条回答
  •  星月不相逢
    2020-12-04 14:50

    This is a warning that will go away once Express updates to use Connect 3.0 - as a temporary fix, follow the instructions at the top of https://github.com/senchalabs/connect/wiki/Connect-3.0. Specifically, find this line in your app:

    app.use(express.bodyParser());
    

    And replace it with the following (this is what bodyParser will be in 3.0):

    app.use(express.json());
    app.use(express.urlencoded());
    

提交回复
热议问题