zuper-graphql
v0.3.0
Published
GraphQL middlewares for Zuper
Downloads
3
Readme
zuper-graphql
GraphQL middlewares for Zuper
Usage
import { Server } from 'http'
import { Application, Router } from 'zuper'
import { graphql, graphiql } from 'zuper-graphql'
import json from 'zuper-json-bodyparser'
import schema from './schema.js'
const server = new Server()
const app = new Application()
const router = new Router()
router.post('/graphql', json, graphql({ schema }))
router.get('/graphiql', graphiql({ endpointURL: '/graphql' }))
app.use(router.middleware)
server.on('request', app.handleRequest)
server.listen(80, '127.0.0.1', () => {
console.log('Server running at http://localhost/')
})