Default usage
Resolvers configurations are grouped into a single configuration property of generateApolloServer and generateSchema.
Here is the simplest example possible to define the "user" model:
Assuming "models" is your import of the Sequelize models folder.
This will by default:
Create a create "user" resolver to list all users
Create the userCreate, userUpdate and userDelete resolvers for the related mutations
Create a "count" resolver
Relations between endpoints
Declaring many models will add the related models AND their associations to your GraphQL schema.
For example:
Will allow you to query:
If you have the relations set in your Sequelize folder.
Any relation linked to a model NOT defined in the graphqlSchemaDeclaration will be ignored. It's up to you to chose what do you expose.
Last updated
Was this helpful?