@graphql-ez/plugin-modules
v0.12.1
Published
Integration with [GraphQL Modules](https://www.graphql-modules.com/)
Readme
@graphql-ez/plugin-modules
Integration with GraphQL Modules
Usage
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';
},
},
},
}
);