Skip to content

skevy/hapi-graphql

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GraphQL Hapi Plugin

Create a GraphQL HTTP server with Hapi. Port from express-graphql.

npm install --save hapi-graphql

Example

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)
  )
);

About

Create a GraphQL HTTP server with Hapi.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%