monorepo for Hono third-party middleware/helpers/wrappers
 
 
Go to file
Minghe d9858558cb
feat(publish): automatically publish to npm registry when codes merged to production branch
2022-07-27 21:59:18 +08:00
.github/workflows feat(publish): automatically publish to npm registry when codes merged to production branch 2022-07-27 21:59:18 +08:00
bun_test init 2022-07-21 08:43:43 +08:00
deno_dist chore: don't emit test files not needed (#4) 2022-07-27 21:25:11 +08:00
deno_test fix(ci): enable deno and fix the pipeline 2022-07-24 17:22:01 +08:00
src init 2022-07-21 08:43:43 +08:00
.gitignore chore: remove and ignore `yarn-error.log` (#3) 2022-07-27 21:25:34 +08:00
README.md init 2022-07-21 08:43:43 +08:00
jest.config.js init 2022-07-21 08:43:43 +08:00
package.json chore: don't emit test files not needed (#4) 2022-07-27 21:25:11 +08:00
tsconfig.build.json chore: don't emit test files not needed (#4) 2022-07-27 21:25:11 +08:00
tsconfig.json init 2022-07-21 08:43:43 +08:00
yarn.lock 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()