fastify-graphql
v4.0.1
Published
Apollo server plugin for Fastify
Downloads
83
Readme
fastify-graphql
A plugin for Fastify that adds GraphQL and GraphiQL support.
This project was forked from fastify-apollo as it is no longer being maintained fast enough to keep pace with the rapid changes happening in the GraphQL ecosystem.
Installation
npm install --save fastify-graphql graphql
or
yarn add fastify-graphql graphql
Usage
const Fastify = require('fastify');
const app = Fastify();
const {graphiqlFastify, graphqlFastify} = require('fastify-graphql');
app.register(graphqlFastify, {
prefix: '/graphql',
graphql: {
schema: your_graphql_schema,
},
});
app.register(graphiqlFastify, {
prefix: '/graphiql',
graphiql: {
endpointURL: '/graphql',
}
});
Configuration
Both plugins need to be given a prefix, under which they will mount.
GraphQL settings extends GraphQLServerOptions
GraphiQL settings extends GraphiQLData