lib |
package.json |
.npmignore |
.babelrc |
.editorconfig |
.eslintrc |
.gitattributes |
hapi-graphql-0.4.0-ccinternal.tgz |
readme.md |
Create a GraphQL HTTP server with Hapi. Port from express-graphql.
npm install --save hapi-graphql
import Hapi from 'hapi'; import GraphQL from 'hapi-graphql'; import {GraphQLSchema} from 'graphql'; const server = new Hapi.Server(); server.connection({ port: 3000 }); const TestSchema = new GraphQLSchema({}); server.register({ register: GraphQL, options: { query: { schema: TestSchema, rootValue: {}, pretty: false }, // OR // // query: (request) => {{ // schema: TestSchema, // rootValue: {}, // pretty: false // }), route: { path: '/graphql', config: {} } } }, () => server.start(() => console.log('Server running at:', server.info.uri) ) );