|
|
|
|
|
by ben_jones
2559 days ago
|
|
Honest question, what about GraphQL is straight forward? As a web developer I've been curious about its hype for a long time but every time I look at its implementation I balk. I have a lot of experience with JSON-REST APIs and RPC systems like gRPC and they both seem clearly superior (especially in tandem with code generators) where as GraphQL seems like a ton of extra work on the client and server side for little gain. When asked most developers say its because you can limit which fields you query, and I have to politely explain to them the existence of an SQL SELECT query... |
|
`GET localhost/graphql`, with body
dogs {
}...and I get back:
dogs: [
]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.