Skip to content

Instantly share code, notes, and snippets.

@helfer
Last active March 7, 2017 12:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save helfer/35fefa143a7fdf7ca101e88574ac0764 to your computer and use it in GitHub Desktop.
Save helfer/35fefa143a7fdf7ca101e88574ac0764 to your computer and use it in GitHub Desktop.
Using Apollo Server with HAPI
import hapi from 'hapi';
import graphql from 'graphql';
import { ApolloHAPI } from 'apollo-server';
const myGraphQLSchema = new graphql.GraphQLSchema({
// define your schema in GraphQL.js syntax here ...
});
const server = new hapi.Server();
const HOST = 'localhost';
const PORT = 3000;
server.connection({
host: HOST,
port: PORT,
});
server.register({
register: new ApolloHAPI(),
options: { schema: myGraphQLSchema },
routes: { prefix: '/graphql' },
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment