honojs-middleware/deno_dist
Yusuke Wada ae6ed501c9
fix: bump up Hono and make it `peerDependencies` to fix type mismatch (#21)
* fix: bump up Hono and make it 'peerDependencies' to fix type mismatch

* fix for lint
2022-12-13 16:32:51 +09:00
..
README.md fix: bump up Hono and make it `peerDependencies` to fix type mismatch (#21) 2022-12-13 16:32:51 +09:00
index.ts fix: bump up Hono and make it `peerDependencies` to fix type mismatch (#21) 2022-12-13 16:32:51 +09: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 @honojs/graphql-server

or

yarn add @honojs/graphql-server

Usage

index.js:

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

export const app = new Hono()

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

const rootResolver = (ctx) => {
  return {
    hello: () => 'Hello Hono!',
  }
}

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

app.fire()