Simple implementation of Backend For Frontend pattern using by graphql
yarn install
yarn start-dev
Get product detail and its comments in single query
query {
product(id :1) {id, name , description, code, quantity, price},
comments(productId:1) {
comment
}
}
{
"data": {
"product": {
"id": 1,
"name": "Cotton Shirt",
"description": "Blue shirt",
"code": "a234bz",
"quantity": 5,
"price": 10
},
"comments": [
{
"comment": "Beautiful"
},
{
"comment": "Good!"
},
{
"comment": "Not bad"
}
]
}
}