GraphQL
Get started with GraphQL and libraries such as Apollo Client and GraphQL Yoga. One schema, one query, and a clear picture of how the pieces meet.
React + Apollo Client + GraphQL Yoga
Set up a small GraphQL server, connect Apollo Client, and run your first query from a React component.
Jan 7, 2019Read the guideWhy a schema first
GraphQL starts with a typed schema. The schema becomes the contract between the server that resolves fields and the client that asks for them.
ConceptGraphQLObjects and references
A resolver returns plain JavaScript objects. If you are comfortable with objects and references, the server side will feel familiar.
LessonOpen ObjectsAsk for exactly what you need
A GraphQL client sends a query that names the fields it wants. The server resolves each field and returns a JSON object with the same shape.
The tradeoff is that the client owns the shape of the response. That is powerful, but it also means the schema and the resolvers have to be designed with care.
query Lesson($id: ID!) {
lesson(id: $id) {
title
path
runtime
}
}