A simple GraphQL API which stores and queries book and author data using MongoDB.
A simple GraphQL API which stores and queries book and author data using MongoDB.
mutation {
addBook(name: "The Great Gatsby", genre: "Fiction", authorId: "1"){
name
genre
}
}
mutation {
addAuthor(name: "F.Scott Fitzgerald", age: 44){
name
age
}
}
{
book(id: "1"){
name
genre
author{
name
age
}
}
}
{
books{
name
genre
author{
name
age
}
}
}
{
author(id: "1"){
name
age
books{
name
genre
}
}
}
{
authors{
name
age
books{
name
genre
}
}
}
npm i
nodemon app.js
localhost:4000/graphql
to open GraphiQL