Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

294
Views
Body Parser Deprecated

I am currently learning node and express. But when I require and use body-parser my code editor(VS Code) says that it is deprecated. How do I work with this? I will link the image of my editor.enter image description here

over 4 years ago · Santiago Trujillo
4 answers
Answer question

0

body parser package is deprecated. If you are using latest version of express you don't have to install body-parser package.

You can directly use

app.use(express.urlencoded({extended:true});
over 4 years ago · Santiago Trujillo Report

0

If you facing 'bodyParser' is deprecated.

Just do

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

Note: If you are using 4.16.0 or later express version.

over 4 years ago · Santiago Trujillo Report

0

Body parser is now added to Express. You can use it like the following:

app.use(express.json());

You can add this middleware to the code which will then be able to use json methods.

over 4 years ago · Santiago Trujillo Report

0

Don't use body-parser

Body parsing is now builtin with express So, simply do

app.use(express.json()) //For JSON requests
app.use(express.urlencoded({extended: true}));

directly from express

You can uninstall body-parser using npm uninstall body-parser



Then you can get the POST content of the request using req.body

app.post("/yourpath", (req, res)=>{

    var postData = req.body;

    //Or like this, for string JSON body

    var postData = JSON.parse(req.body);
});
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!