Resolvers
Resolvers
Resolver is a collection of functions that generate response for a GraphQL query. You can think of Resolvers like Controllers from REST. It basically handlers GraphQL query just like controllers where the endpoint has particular controller resolvers does the same thing but for query instead of an endpoint.
Lets take a look at one of an example in the project located at enatega-multivendor-api/graphql/resolvers/auth
createUser
is one of the resolver functions it creates a new User just like in REST the parameter are found in args
you may have noticed that in line 3
we have to call another object inside args
called userInput
this is the inputType
for every query its a good practice to write its inputType
the rest of the code is pretty simple.
Last updated