|
||
---|---|---|
.github/workflows | ||
bun_test | ||
deno_dist | ||
deno_test | ||
src | ||
.gitignore | ||
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 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()