Do we need to use body-parser still?

75 Views Asked by At

I have seen in many tutorials that people are using both express.json and bodyPaser.json middleware. Are they not doing the same thing?

1

There are 1 best solutions below

0
Quentin On

They don't just do the same thing, they are the same thing.

Express has a dependency on body-parser, and it exposes body-parser through its own API.

If you're writing an Express app then the only reason to use body-parser directly is if, for some reason, you needed a newer version of it than Express provides.