Questions tagged [body-parser]

node.js body parsing middleware

975 questions
486
votes
11 answers

What does body-parser do with express?

I don't understand why we need body-parser in an Express application, as we can get data without using body-parser. And what does it do actually and how?
jiten
  • 5,005
  • 3
  • 12
  • 8
127
votes
3 answers

What does 'extended' mean in express 4.0?

I'm using express and also body-parser in my app. app.use(bodyParser.urlencoded({ extended: false })); But, What does 'extended' mean in express 4.0? I found this extended - parse extended syntax with the qs module. However, I still can't…
KimCrab
  • 2,231
  • 4
  • 15
  • 20
94
votes
3 answers

BodyParser is deprecated

As the image shown, BodyParser now is deprecated, how to correct the bodyParser syntax or statement to remove the line-through?
Fu Nian Wong
  • 1,047
  • 1
  • 6
  • 14
66
votes
3 answers

What does `app.use(bodyParser.json())` do?

For: bodyParser.urlencoded({extended: ...}) my research shows me that if extended: true, then you can parse nested objects, or generally any type. However, if you set extended: false, then you can only parse strings or arrays. But what does…
Grateful
  • 9,685
  • 10
  • 45
  • 77
50
votes
7 answers

Node.js (with express & bodyParser): unable to obtain form-data from post request

I can't seem to recover the form-data of a post request sent to my Node.js server. I've put below the server code and the post request (sent using postman in chrome): Post request POST /api/login HTTP/1.1 Host: localhost:8080 Cache-Control:…
Jem
  • 6,226
  • 14
  • 56
  • 74
30
votes
2 answers

fetch() POST request to Express.js generates empty body {}

Goal: send some defined string data from HTML in a fetch() function e.g. "MY DATA" My code: HTML