fix(doc): update readme and bump version (#14)
parent
1a31ccfe41
commit
20b1c8fe9f
16
README.md
16
README.md
|
@ -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,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -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",
|
||||||
|
|
Loading…
Reference in New Issue