A repository to learn about both - server and client side implementation of graphQL.
MIT License
A repository to learn about both - server and client side implementation of graphQL.
I'll be following the GraphQL tutorial by The Net Ninja.
The following tech-stack is used in the entire program:
I will be building a service that would show details about books using graph queries from the frontend.
The backend should be run on port 4000 by following the below instructions:
#install nodejs and npm
cd /path/to/graphql-PG/backend
npm install
npm start
Keeping the backend running, frontend should be run using the following commands:
cd /path/to/graphql-PG/frontend
npm install
npm start
The webpage will be opened up in the browser.
The following graphQL queries can be made (with GET) to backend.
{
books{
id
name
genre
author{
AUTHOR_NODE
}
}
}
{
authors{
id
name
age
books{
BOOK_NODE
}
}
}
{
book(id:$ID){
id
name
author{
AUTHOR_NODE
}
}
}
{
author(id:$ID){
id
name
age
books{
BOOK_NODE
}
}
}
If you are a REST fan and would like to know why GraphQL is better, here are the reasons:
https://www.robinwieruch.de/why-graphql-advantages-disadvantages-alternatives/