StonyTV / graphql-http

A GraphQL http server and client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@hydre/graphql-http

GraphQL over http

Install

npm i @hydre/graphql-http

Usage

| KoaJS

import Koa from 'koa'
import { readFileSync } from 'fs'
import bodyParser from 'koa-bodyparser'
import graphql from 'graphql'
import graphqlHTTP from '@hydre/graphql-http/koa'

const { buildSchema } = graphql
const schema = buildSchema(readFileSync('/path/to/schema.gql', 'utf-8'))
const app = new Koa().use(bodyParser()).use(
  graphqlHTTP({
    schema,
    rootValue: {},
    buildContext: async ctx => {},
    formatError: error => error,
  })
)

app.listen(3000)

About

A GraphQL http server and client

License:The Unlicense


Languages

Language:JavaScript 100.0%