← GraphQL learning pathGraphQL · Module 5 of 10
Resolvers
Write functions that fetch the data for each field.
📖 Key ideas
- Each field can have a resolver function.
- Signature: (parent, args, context, info).
- Context carries shared things: user, database, loaders.
- Resolvers can fetch from databases, REST APIs or other services.
- Default resolvers return the property of the same name.
💡 Real-life example: Resolvers are shop assistants: each knows where to fetch one item on your list.
ResolverFunction returning a field's data
parentResult of the parent field
argsField arguments
contextShared per-request data