@nbn23/graphql-directives
v1.1.4
Published
GraphQL custom directives library
Downloads
48
Readme
graphql-directives
This is a series of tools to be able to create and bind custom directives in our GraphQL schemas. This utility has support to Apollo Federation schemas.
Getting Started
Install 'graphql-directives' using npm.
npm install --save @nbn23/graphql-directives
Note: 'graphql-directives' assumes a TypeScript environment
Usage
import { DirectiveManager, BatchingDirective } from "@nbn23/graphql-directives";
const batchingDirective = new BatchingDirective();
const directiveManager = new DirectiveManager(batchingDirective);
const subgraphSchema = buildSubgraphSchema([
{
typeDefs: directiveManager.mergeTypeDefs(typeDefs),
resolvers
}
]);
const schema = directiveManager.mapSchema(subgraphSchema);
const server = new ApolloServer({
schema,
.
.
.
});