@hono/graphql-server
TypeScript icon, indicating that this package has built-in type declarations

0.4.3 • Public • Published

GraphQL Server Middleware

Requirements

This middleware depends on GraphQL.js.

npm i @hono/graphql-server

or

yarn add @hono/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()

Author

Minghe Huang h.minghe@gmail.com

Readme

Keywords

none

Package Sidebar

Install

npm i @hono/graphql-server

Weekly Downloads

403

Version

0.4.3

License

MIT

Unpacked Size

11.4 kB

Total Files

6

Last publish

Collaborators

  • yusukebe