monorepo for Hono third-party middleware/helpers/wrappers
 
 
Go to file
Minghe f84cdc88a0
feat(tag): auto tag release (#16)
2022-08-02 11:03:36 +08:00
.github/workflows feat(tag): auto tag release (#16) 2022-08-02 11:03:36 +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 Access ctx in resolve (#13) 2022-08-01 22:06:46 +08:00
.eslintignore feat(lint): enable lint (#11) 2022-07-30 21:36:01 +08:00
.eslintrc.js feat(lint): enable lint (#11) 2022-07-30 21:36:01 +08:00
.gitignore chore: remove and ignore `yarn-error.log` (#3) 2022-07-27 21:25:34 +08:00
.prettierrc feat(lint): enable lint (#11) 2022-07-30 21:36:01 +08:00
README.md fix(doc): update readme and bump version (#14) 2022-08-01 22:49:02 +08:00
jest.config.js init 2022-07-21 08:43:43 +08:00
package.json fix(doc): update readme and bump version (#14) 2022-08-01 22:49:02 +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 feat(lint): enable lint (#11) 2022-07-30 21:36: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 '@hono/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()