dimfeld / fastify-apollo

Run an Apollo Server on Fastity.

Home Page:https://www.npmjs.com/package/fastify-apollo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Run an Apollo Server for Fastify.



Install

npm install --save fastify-apollo graphql

Register plugin

fastify.register(require("fastify-apollo"), {
    graphql: { schema },
    graphiql: true
});

Endpoints

Path Renders
/{prefix} GraphQL endpoint
/{prefix}/graphiql GraphiQL
/{prefix}/schema GraphQL schema

Options

Prefix

Defaults to "/".

options.prefix = "/api"

GraphQL

Extends GraphQLServerOptions from Apollo.

options.graphql = { schema }

GraphiQL

Uses resolveGraphiQLString under the hood. Extends GraphiQLData.

If no options are supplied for GraphiQL or it is truthy its endpointURL will default to the prefix.

options.graphiql = true

PrintSchema

Prints graphql schema...obviously requires graphql.

options.printSchema = true

About

Run an Apollo Server on Fastity.

https://www.npmjs.com/package/fastify-apollo

License:MIT License


Languages

Language:JavaScript 100.0%