|
On the front-end, with GraphQL you simply specify exactly the data you want on the client, e.g: `GET localhost/graphql`, with body dogs { name
location {
city
}
isAGoodBoy
}...and I get back: dogs: [ {
Fido,
location: {
Boston
},
true
},
{
Spot,
location: {
Los Angeles
},
true
},
...
]No extra fields. My clients page doesn't care about the dog's UUID, weight, etc. No routes. Everything goes to `localhost/graphql`. It makes writing clients an absolute joy, and it works gloriously with React. Tell the server exactly what you want, and get exactly that. On the back-end, every field (name, isAGoodBoy) is a resolver. Maybe it's a simple database call to retrieve that field. Maybe it's some service that pulls crap from an S3 bucket. GraphQL doesn't care. So the level of difficulty of implementing a GQL server is dependent on your back-end. For most folks, you'll just be making calls to a database. |