* fix: bump up Hono and make it 'peerDependencies' to fix type mismatch * fix for lint |
||
---|---|---|
.github/workflows | ||
bun_test | ||
deno_dist | ||
deno_test | ||
src | ||
.eslintignore | ||
.eslintrc.js | ||
.gitignore | ||
.prettierrc | ||
README.md | ||
jest.config.js | ||
package.json | ||
tsconfig.build.json | ||
tsconfig.json | ||
yarn.lock |
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()