apollographql / apollo-server

🌍  Spec-compliant and production ready JavaScript GraphQL server that lets you develop in a schema-first way. Built for Express, Connect, Hapi, Koa, and more.
https://www.apollographql.com/docs/apollo-server/
MIT License
13.76k stars 2.03k forks source link

Consider updating Express integration docs to use `express.json()` instead of `body-parser` #7224

Open glasser opened 1 year ago

glasser commented 1 year ago

Huh, apparently for 5 years (since v4.16.0) you can do express.json() instead of also installing body-parser. Maybe we should do that in the standalone server and in our docs around using expressMiddleware.

On the other hand, perhaps it's nicer to directly depend on your dependencies so you can get bug fixes via direct upgrades rather than transitive upgrades, so maybe we should leave it as is.

See https://community.apollographql.com/t/is-it-necessary-to-install-bodyparser/5163

trevor-scheer commented 1 year ago

I prefer the latter, though not opposed to documenting express.json as a simpler-but-not-our-preference option.