You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm slightly confused at the paramters passed to GraphQLModule. When importing modules, it works but then I wonder what the purpose of the typeDefs and resolvers fields are for, if the imports field internally manages merging type definitions and resolvers.
I also know that I could import all of my resolvers and type definitions using array notation on each module. IE: resolvers: [ArticleModule['resolvers'], UserModule['resolvers']],
I know this is a question but I've spent a bit of time puzzled on this so this question will turn into a PR for updating docs. Thanks!
Here's my main.ts (entry point)
import{GraphQLModule}from'@graphql-modules/core';import{ApolloServer}from'apollo-server';import{ArticleModule}from'./modules/ArticleModule';import{UserModule}from'./modules/UserModule';const{ schema, context }=newGraphQLModule({typeDefs: [],resolvers: [],imports: [ArticleModule,UserModule],});constserver=newApolloServer({
schema,
context,});server.listen().then(({ url })=>{console.log(`🚀 Server ready at ${url}`);});
The text was updated successfully, but these errors were encountered:
If you are just merging together two modules (ArticleModule, UserModule) and you don't need additional typeDefs or resolvers as part of the new schema, then you don't need to specify them.
I'm slightly confused at the paramters passed to
GraphQLModule
. When importing modules, it works but then I wonder what the purpose of thetypeDefs
andresolvers
fields are for, if theimports
field internally manages merging type definitions and resolvers.I also know that I could import all of my resolvers and type definitions using array notation on each module. IE:
resolvers: [ArticleModule['resolvers'], UserModule['resolvers']],
I know this is a question but I've spent a bit of time puzzled on this so this question will turn into a PR for updating docs. Thanks!
Here's my
main.ts
(entry point)The text was updated successfully, but these errors were encountered: