📎 Webclip
GraphQL Crash Course (in 10 pics!)
This crash course explains GraphQL as a query language for flexible API calls. It shows how a single request can ask for nested fields and receive data in the exact shape needed, with validation and resolution handled by a schema and resolver functions.
Reading notes#
- GraphQL is described as a query language, not a library, used for flexible API calls.
- A request can ask for nested fields and receive a payload in the exact shape requested.
- The server validates queries against a schema and uses resolver functions to prepare the response.
- The schema defines valid queries, return types, and the communication contract between client and server.
- GraphQL supports object types, unions, enums, and interfaces, and has query, mutation, and subscription operations.
- Arguments can filter results, but comparison operators and limits are not built into GraphQL and must be implemented in resolvers.
- Aliases are used when the same field is selected multiple times with different arguments.
- Fragments let repeated subfields be reused across selections.
- Variables are declared in the query, can have default values, and are sent in the request payload.
- Interfaces support flexible complex types, and the
onkeyword selects fields for a specific implementation. - Mutations change server-side data and still return values, so selected fields matter.
- Subscriptions use WebSocket connections to push continuous updates, which suits real-time apps.
- The post recommends GraphiQL, GraphQL Playground, and other public APIs for practice and debugging.
