https://github.com/pathaknv/graphql-app
A small graphQL dummy rails app
https://github.com/pathaknv/graphql-app
graphiql graphql graphql-ruby rails ruby
Last synced: 6 months ago
JSON representation
A small graphQL dummy rails app
- Host: GitHub
- URL: https://github.com/pathaknv/graphql-app
- Owner: pathaknv
- Created: 2020-02-24T06:10:05.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-19T17:33:53.000Z (over 2 years ago)
- Last Synced: 2025-02-13T08:52:25.044Z (8 months ago)
- Topics: graphiql, graphql, graphql-ruby, rails, ruby
- Language: Ruby
- Homepage:
- Size: 83 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GraphQL sample API only rails app
Following are some sample queries
### Query Types:
```
query fetchUser {
user(id: 9) {
id
name
}
}
``````
query fetchUsers {
users {
id
name
booksCount
books {
id
title
}
}
}
``````
query fetchLimitedBooksOfUsers {
users {
id
name
booksCount
books(limit: 2) {
id
title
}
}
}
``````
query fetchLimitedUsers {
users(page: 2, limit: 3) {
id
name
booksCount
books {
id
title
}
}
}
``````
query fetchBook {
book(id: 1) {
id
title
userName
}
}
``````
query fetchBooks {
books {
id
title
userName
}
}
``````
query fetchLimitedBooks {
books(page: 2, limit: 4) {
id
title
userName
}
}
```### Mutations:
```
mutation createUser {
createUser(input: { name: "Nikhil Pathak", email: "nikhil@gmail.com" }) {
user {
id
name
}
errors
}
}
``````
mutation updateUser {
updateUser(input: { id: 9, email: "nikhil.pathak@gmail.com" }) {
user {
id
name
}
errors
}
}
``````
mutation deleteUser {
deleteUser(input: { id: 9 }) {
message
}
}
``````
mutation createBook {
createBook(input: { userId: 7, title: "Harry Potter - Part 1" }) {
book {
id
title
userName
}
errors
}
}
``````
mutation updateBook {
updateBook(input: { id: 23, title: "Harry Potter - Philosopher Stone" }) {
book {
id
title
userName
}
errors
}
}
``````
mutation deleteBook {
deleteBook(input: { id: 23 }) {
message
}
}
```