2.1.0 • Published 7 years ago

fastify-apollo v2.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

fastify-apollo

Install

npm install --save fastify fastify-apollo graphql

Register plugin

fastify.register(require("fastify-apollo"), {
    graphql: { schema, rootValue },
    graphiql: {
      endpointURL: "/"
    },
    prefix: "/api",
    printSchema: true // `/api/schema`
});

GraphQL

Extends GraphQLServerOptions from Apollo.

const { graphqlFastify } = require("fastify-apollo");

fastify.register(graphqlFastify, {
  schema
})

GraphiQL

Uses resolveGraphiQLString under the hood. Extends GraphiQLData.

const { graphqlFastify } = require("fastify-apollo");

fastify.register(graphiqlFastify, {
  endpointURL: "/",
  prefix: "/graphiql"
})