GraphQL by Example
What you’ll learn
Build a GraphQL server based on NodeJS, Express and Apollo Server
Handle Authentication/Authorization, Caching, and more
Receive real-time updates with GraphQL Subscriptions
Some knowledge of Express and React preferable but not strictly required
More and more teams are choosing GraphQL instead of (or along with) REST for their web APIs. GraphQL queries give clients great flexibility in the way they request data from the server, preventing issues such overfetching or underfetching of data, and allowing multiple resources to be retrieved in a single request.
The examples use Apollo Server with Node.js and Express on the backend and React on the frontend, with GraphQL-Request first, then Apollo Client as GraphQL clients. GraphQL-WS is used for subscriptions.
The aim however is not just to cover specific GraphQL libraries, but to give you a more general understanding of the underlying concepts. For instance, GraphQL client libraries are introduced only after learning how to write a simple client “by hand”, to make sure you understand the GraphQL over HTTP format.