Why am I getting 'bodyParser' is deprecated warning?

0

Issue

I used the latest version of both packages but still, I am getting ‘bodyParser’ is a deprecated warning. It is not affecting my code but why is this happening?

const express =  require("express")
const bodyParser =  require("body-parser")

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

app.listen(port, () => {
    console.log(`Welcome to ${port}`);
});

Solution

It means that body-parser want you to use a different method (.json() or .urlencoded()):

https://github.com/expressjs/body-parser/commit/b7420f8dc5c8b17a277c9e50d72bbaf3086a3900

Answered By – Allan Wind

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More