Skip to content

byte-fe/fastify-graphql

 
 

Repository files navigation

fastify-graphql

Travis npm Conventional Commits

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

Packages

No packages published

Languages

  • TypeScript 100.0%