https://github.com/takp/graphql-node-sample
Sample GraphQL project with Node and express
https://github.com/takp/graphql-node-sample
Last synced: about 2 months ago
JSON representation
Sample GraphQL project with Node and express
- Host: GitHub
- URL: https://github.com/takp/graphql-node-sample
- Owner: takp
- Created: 2017-06-24T23:50:31.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-25T01:37:45.000Z (over 8 years ago)
- Last Synced: 2024-12-27T09:27:59.288Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 8.79 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# graphql-node-sample
This is sample project for [GraphQL](http://graphql.org/) with Node and express.
## Start
```bash
$ yarn add graphql
$ yarn add express express-graphql
```
## Run
```bash
$ node index.js
```
and open [http://localhost:3000/graphql](http://localhost:3000/graphql).
## Get video by ID
Input
```
{
video(id: 1){
id,
title,
watched,
}
}
```
and you can get
```
{
"data": {
"video": {
"id": "1",
"title": "title 1",
"watched": true
}
}
}
```
## Mutate video
Input
```
mutation M {
createVideo(title: "hoge") {
id,
title,
watched,
}
}
```
and you can get
```
{
"data": {
"createVideo": {
"id": "3",
"title": "hoge",
"watched": false
}
}
}
```
# Ref
- http://graphql.org/