https://github.com/takp/graphql-ruby-sample
Sample GraphQL project with Ruby and Ruby on Rails
https://github.com/takp/graphql-ruby-sample
Last synced: 3 months ago
JSON representation
Sample GraphQL project with Ruby and Ruby on Rails
- Host: GitHub
- URL: https://github.com/takp/graphql-ruby-sample
- Owner: takp
- Created: 2017-06-25T01:39:42.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-25T01:48:48.000Z (almost 8 years ago)
- Last Synced: 2024-12-27T09:27:58.982Z (5 months ago)
- Language: Ruby
- Size: 25.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# graphql-ruby-sample
This is sample project for [GraphQL](http://graphql.org/) with Ruby on Rails.
## Versions
- Ruby 2.3.1
- Rails 5.1.1## Run
```bash
$ bundle
$ bin/rake migrate
$ bin/rails s
```and open [http://localhost:3000/graphiql](http://localhost:3000/graphiql).
## Get video by ID
Input
```
{
video(id: 1){
id,
title,
watched,
}
}
```and you can get
```
{
"data": {
"video": {
"id": "1",
"title": "Hoge movie",
"watched": true
}
}
}
```## Mutate video
Input
```
mutation Video {
add_video(video:{title: "AAA"}) {
id,
title,
watched
}
}
```and you can get
```
{
"data": {
"add_video": {
"id": "23",
"title": "AAA",
"watched": false
}
}
}
```# Ref
- http://graphql.org/
- http://graphql-ruby.org/
- https://github.com/rmosolgo/graphql-ruby