Is it necessary to install bodyParser?

Hi Team, thank you for awesome package!
I found a description in the documentation that caught my attention.

When using Express middleware, you are supposed to install bodyParser, but It should be built-in from Express v4.16.0 and above.
Therefore, the installation of bodyParser should be erased.
You may want to write a note if you are using a version lower than express v4.15.5, but 4.16.0 was released on 2017-09-28, and I don’t think many people are using old express now, so it’s probably best to just mention it lightly!

- bodyParser.json(),
+ express.json(),

ref:

Interesting point. I opened an issue: Consider updating Express integration docs to use `express.json()` instead of `body-parser` · Issue #7224 · apollographql/apollo-server · GitHub

In general I do think directly depending our your dependencies is a better practice than taking transitive pass-through dependencies like this, since if body-parser fixes a bug or adds a feature then it’s much easier to upgrade if it’s a direct dependency… but having our docs be simpler is nice too.

1 Like