BodyParser is deprecated

Solution 1:

If you are using Express 4.16+ you don't have to import body-parser anymore. You can do it just like this:

app.use(express.urlencoded({extended: true}));
app.use(express.json()) // To parse the incoming requests with JSON payloads

Solution 2:

Same issue occur to my projects also . Now in latest express we don't need to import body-parse, we can just use express as follow.

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

or if you limit size

app.use(express.urlencoded({ limit: "50mb", parameterLimit: 500000000 }));