Express needs this package so it understands it.
GraphQL.js provides two important capabilities: building a type schema, and serving queries against that type schema.
to start npm run dev.
However we need to pass
{
book(id: "1"){
name
genre
id
}
}
{
book(id: 2) {
name
genre
author{
name
age
id
}
}
}
{
author(id: 3) {
name
age
books{
name
id
}
}
}
because we have done the relationship between the books and the author. This will get you all the books and their authors
{books {
id
name
genre
author{
name
age
}
}}
because we have done the relationship between the books and the author. This will get you all the books for each author
{
authors {
name
age
books{
name
}
}
}
first you need to create a user and then connect it to mongoose khaledkzy:emp123
means changing the data (Add authors, delete authors)
mutation {
addAuthor(name: "Khaled", age: 25){
name
age
}
}
we can get the id from there
mutation {
addBook(name: "The Earth", genre: "action", authorId: "5c5729060f731244a75db3fe") {
name
genre
}
}
{
books{
name
genre
author{
name
age
}
}
}
mutation {
updateAuthor(id: "5c572fed00b4ee480573f3c4", name: "Khaled Zaki", age: 55 ) {
name
age
}
}
Make a folder called client and run
npx create-react-app
.