honojs-middleware/deno_dist
Yusuke Wada d2fcbb005d
chore: don't emit test files not needed (#4)
2022-07-27 21:25:11 +08:00
..
README.md fix(ci): enable deno and fix the pipeline 2022-07-24 17:22:01 +08:00
index.ts fix(ci): enable deno and fix the pipeline 2022-07-24 17:22:01 +08:00
mod.ts fix(ci): enable deno and fix the pipeline 2022-07-24 17:22:01 +08:00
parse-body.ts fix(ci): enable deno and fix the pipeline 2022-07-24 17:22:01 +08:00

README.md

GraphQL Server Middleware

Requirements

This middleware depends on GraphQL.js.

npm i graphql

or

yarn add graphql

Usage

index.js:

import { Hono } from 'hono'
import { graphqlServer } from 'hono/graphql-server'
import { buildSchema } from 'graphql'

export const app = new Hono()

const schema = buildSchema(`
type Query {
  hello: String
}
`)

const rootValue = {
  hello: () => 'Hello Hono!',
}

app.use(
  '/graphql',
  graphqlServer({
    schema,
    rootValue,
  })
)

app.fire()