Today one of our developers demonstrate how they could implement GraphQL and showed the avantages of this product. My knowledge about GraphQL is nearly zero so this is a nice opportunity to find out what GraphQL really is and what can it do.
GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data.
Nice, but what does that mean?
GraphQL makes it possible to exactly get what you ask, nothing more and nothing less. Where REST API’s require loading from multiple endpoints, GraphQL needs only a single request. It makes use of types so your App only ask for what’s possible. GraphQL is fast even on slow mobile networks. REST use three calls for three requests, give GraphQL three addresses and you can ask whatever want with just one call.
How does it work?
You can ask GraphQL something with a query. A typical query looks like : query { stuff}
So use the query keyword followed by a field like stuff. Nesting is also possible query { stuff { level1 level2 level3 }}
. For the client it doesn’t matter where the data is located, where the date is coming from, GraphQL take care of it.
More to follow……