Advanced CommunicationLesson 71Free preview
GraphQL
This lesson is part of Node.js · All levels
Summary
This lesson introduces GraphQL to the Node.js ecosystem: a query language where the client requests exactly the data needed from an endpoint. You learn to define a schema with type and query, then write a resolver that pulls data from the server. Compared to REST, GraphQL reduces over-fetching and under-fetching.
Key points
- GraphQL is a query language for single endpoint APIs (usually POST/graphql).
- Schema defines data type and operation (Query, Mutation).
- Resolver is a JavaScript function that fills in every field in a schema.
- Popular library at Node.js: graphql and Apollo Server / graphql-http.
- The client selects the field in the query so that no excess data is sent.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.