query {
book {
title
author
}
}{
"book": {
"title": "Norwegian Wood",
"author": "Murakami",
}
}// schema.gql
type Book {
title: String
author: String
publisher: String
}
type Query {
book: Book
}GET / book
GET / author
GET / publisher
request 1
request 2
request 3
/ graphql
query {
book {
title
author
publisher
}
}query {
book {
title
}
}// schema.gql
type Book {
title: String
publisher: String
author: Author
}
type Author {
name: String
lastName: String
year: Int
}// schema.gql
type Book {
title: String
publisher: String
author: Author
}
type Author {
name: String
lastName: String
year: Int
}
type Query {
book: Book
}query {
book {
title
author {
name
}
publisher
}
}// response.json
{
"book": {
"title": "Norwegian Wood",
"author": {
"name": "Murakami"
},
"publisher": "Vintage Books"
}
}// schema.gql
input BookInput {
title: String
author: Author
}
type Author {
name: String
lastName: String
year: Int
}
type Mutation {
addBook(data: BookInput): String
}mutation {
addBook (
data: {
title: "1Q84"
author {
name: "Murakami"
}
}
)
}// response.json
{
"addBook": "Book added"
}