← GraphQL learning path
GraphQL · Module 5 of 10

Resolvers

Write functions that fetch the data for each field.

📖 Key ideas

  1. Each field can have a resolver function.
  2. Signature: (parent, args, context, info).
  3. Context carries shared things: user, database, loaders.
  4. Resolvers can fetch from databases, REST APIs or other services.
  5. 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