* test(workspace): upgrade to vitest v3 Fixes #1007 * chore(standard-validator): add vitest type to `tsconfig.json` * chore: update `yarn.lock` * chore(zod-openapi): bump `typescript` * chore(typia-validator): make it ESM * ci(bun-transpiler): fix Bun to v1.1.32 --------- Co-authored-by: Yusuke Wada <yusuke@kamawada.com> |
||
---|---|---|
.. | ||
bun_test | ||
src | ||
CHANGELOG.md | ||
README.md | ||
package.json | ||
tsconfig.json | ||
vitest.config.ts |
README.md
GraphQL Server Middleware
Requirements
This middleware depends on GraphQL.js.
npm i @hono/graphql-server
or
yarn add @hono/graphql-server
Usage
index.ts:
import { Hono } from 'hono'
import { type RootResolver, graphqlServer } from '@hono/graphql-server'
import { buildSchema } from 'graphql'
export const app = new Hono()
const schema = buildSchema(`
type Query {
hello: String
}
`)
const rootResolver: RootResolver = (c) => {
return {
hello: () => 'Hello Hono!',
}
}
app.use(
'/graphql',
graphqlServer({
schema,
rootResolver,
graphiql: true, // if `true`, presents GraphiQL when the GraphQL endpoint is loaded in a browser.
})
)
app.fire()
Author
Minghe Huang h.minghe@gmail.com