-
ruby version : ruby 2.4.1
-
Rails version 5.1.4
-
I did this simple test project with Rails and GraphQl, to see how GraphQl works :D
-
first run
rake db:drop db:create db:migrate db:seed
{
user(id:1) {
first_name
address
posts {
id
body
user {
id
}
comments {
id
body
}
}
}
}
{
"user": {
"first_name": "Rodrigo",
"last_name": "Barreto"
}
}
mutation createUser($user: UserInputType){
createUser(user: $user) {
#return message errors in array
errors
first_name
last_name
}
}
mutation updateUser($user: UserInputType){
updateUser(id: 1, user: $user) {
#return message errors in array
errors
id
first_name
last_name
}
}
mutation {
deleteUser(id: 1)
}
{
allUsers {
id
first_name
posts {
id
body
}
}
}