yarn add @graphql-ez/plugin-modulespnpm add @graphql-ez/plugin-modulesnpm install @graphql-ez/plugin-modulesIntegration with GraphQL Modules
This plugin add an extra registerModule helper in your ezApp, which will automatically add the specified GraphQL Module in your GraphQL EZ Application,
this plugin will take care of the rest.
This plugin works the best paired with the GraphQL Code Generator plugin with the option deepPartialResolvers enabled (already enabled by default)
import { ezGraphQLModules, gql } from '@graphql-ez/plugin-modules';
const ezApp = CreateApp({
ez: {
plugins: [
ezGraphQLModules({
// ApplicationConfig https://www.graphql-modules.com/docs/api#applicationconfig
}),
// ...
],
},
// ...
});
// ...
ezApp.registerModule(
gql`
type Query {
hello: String!
}
`,
{
resolvers: {
Query: {
hello(_root, _args, _ctx) {
return 'Hello World';
},
},
},
}
);
// ...
ezApp.registerModule(
gql`
extend type Query {
bye: String!
}
`,
{
resolvers: {
Query: {
bye(_root, _args, _ctx) {
return 'Bye World';
},
},
},
}
);
@graphql-ez/plugin-modulesMIT0.12.1Jan 4th, 2024