4.1.1 • Published 3 years ago

@autotelic/apollo-server-fastify v4.1.1

Weekly downloads
70
License
MIT
Repository
github
Last release
3 years ago

apollo-server-fastify

This is a self contained version of apollo-server-fastify, completely detached from the Apollo Server monorepo. It has been modified to be compatible with Fastify v3.

Usage

Only compatible with Fastify v3 or higher.

npm install @autotelic/apollo-server-fastify
const { ApolloServer } = require('apollo-server-fastify');
const { typeDefs, resolvers } = require('./module');

const server = new ApolloServer({
  typeDefs,
  resolvers,
  context: ({ request, reply }) => ({
    fastifyReq: request,
    fastifyReply: reply,
  }),
});

const app = require('fastify')();

(async function() {
  await server.start();
  app.register(server.createHandler());
  await app.listen(3000);
})();