@autotelic/apollo-server-fastify
v4.1.1
Published
Production-ready Node.js GraphQL server for Fastify
Downloads
59
Readme
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);
})();