Bye bye body-parser
February 17, 2020
Today I learned that you don’t need to use body-parser
in Express applications anymore, completely by chance!
I was watching this MERN stack intro video randomly to see if it made a bit more sense now that I have some more experience with React. And in this part of the video he makes an off-handed comment that body-parser
isn’t needed anymore. I ignored this.
Then later I was watching this MEVN (or whatever the acronym is if you use Vue) playlist because I want to try my hand at Vue. And he does use body-parser
.
Now the Vue tutorials were made in October 2018 and the MERN tutorial is from June 2019. And I’ve definitely been using body-parser
in Express apps since both of these, so what did I miss?
The body-parser
package is still maintained as middleware for Express but it doesn’t seem to get any reference in the Express docs anymore.
Well apparently body-parser
was added back into Express in 2017 and hasn’t been needed all this time! It’s still using body-parser
under the hood so in a way it doesn’t really make much difference, but yay for finding out there’s one less dependency to worry about in my Express apps!
And now I am subscribed to release updates for Express 😁