fix(doc): update readme and bump version (#14)

pull/29/head
Minghe 2022-08-01 22:49:02 +08:00 committed by GitHub
parent 1a31ccfe41
commit 20b1c8fe9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 8 deletions

View File

@ -4,14 +4,14 @@
This middleware depends on [GraphQL.js](https://www.npmjs.com/package/graphql). This middleware depends on [GraphQL.js](https://www.npmjs.com/package/graphql).
```plain ```sh
npm i graphql npm i @honojs/graphql-server
``` ```
or or
```plain ```plain
yarn add graphql yarn add @honojs/graphql-server
``` ```
## Usage ## Usage
@ -20,7 +20,7 @@ index.js:
```js ```js
import { Hono } from 'hono' import { Hono } from 'hono'
import { graphqlServer } from 'hono/graphql-server' import { graphqlServer } from '@hono/graphql-server'
import { buildSchema } from 'graphql' import { buildSchema } from 'graphql'
export const app = new Hono() export const app = new Hono()
@ -31,15 +31,17 @@ type Query {
} }
`) `)
const rootValue = { const rootResolver = (ctx) => {
hello: () => 'Hello Hono!', return {
hello: () => 'Hello Hono!',
}
} }
app.use( app.use(
'/graphql', '/graphql',
graphqlServer({ graphqlServer({
schema, schema,
rootValue, rootResolver,
}) })
) )

View File

@ -1,6 +1,6 @@
{ {
"name": "@honojs/graphql-server", "name": "@honojs/graphql-server",
"version": "0.0.3", "version": "0.0.4",
"repository": "git@github.com:honojs/grahql-server.git", "repository": "git@github.com:honojs/grahql-server.git",
"author": "Minghe Huang <h.minghe@gmail.com>", "author": "Minghe Huang <h.minghe@gmail.com>",
"main": "dist/index.js", "main": "dist/index.js",