Last active
March 7, 2017 12:44
-
-
Save helfer/35fefa143a7fdf7ca101e88574ac0764 to your computer and use it in GitHub Desktop.
Using Apollo Server with HAPI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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