npm i @hydre/graphql-http
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)