The Guild LogoThe Guild Monogram

Search docs

Search icon

Products by The Guild

Products

Hive logoHive blurred logo

Hive

Schema Registry for your GraphQL Workflows

Envelop Logo

Envelop

Get Started

Plugin Hub > useGraphQLModules

yarn add @envelop/graphql-modules

@envelop/graphql-modules#

This plugins integrates graphql-modules execution lifecycle into the GraphQL execution flow.

If you are using graphql-modules dependency injection - this setup is needed in order to make sure Injector is created and destroyed at the right time.

Getting Started#

yarn add @envelop/graphql-modules

Usage Example#

import { envelop } from '@envelop/core'; import { createApplication } from 'graphql-modules'; import { useGraphQLModules } from '@envelop/graphql-modules'; const myApp = createApplication({ modules: [ ... ] }) const getEnveloped = envelop({ plugins: [ // ... other plugins ... useGraphQLModules(myApp), ], });

Then, you can use GraphQL-Modules injector in your resolvers:

const resolvers = { Query: { foo: (root, args, context, info) => { const myProviderInstance = context.injector.get(...); } } }

Plugin Details