This is a ExpressJS application serving GraphQL queries
Get all books & their author details
{
books {
id
name
authorId
author {
name
}
}
}
Get all authors & their books
{
authors {
id
name
books {
name
id
}
}
}
Get book by id
{
book(id: 1) {
name
author {
name
}
}
}
Get author by id
{
author(id: 1) {
name
}
}
Get all books by author name
{
author (name: "J. K. Rowling") {
name
books {
name
id
}
}
}
Add new book to array
mutation{
addBook ( name: "Atomic Habbits", authorId: 1) {
name
authorId
}
}