Using REST is a must-do for API building, today. GraphQL allows another interesting way to display content.
What is GraphQL?
Why do we use GraphQL?
GraphQL allows :
- To only get the requested information (and only the information needed)
- To create nested requests (for example: gettingblog posts and each blog post’s commentaries in a row)
- To get an « automatic » documentation that deals with the data’s structure we can get. GraphQL forecasts it and tools are available to know results structure to choose what kind of information we would like to render, relation between them and so on.
- To be version independent. As we get what we requested, when a field isn’t used anymore, we can deprecate it to warn the technical team, but the information remains available for the needed duration.
GraphQL, how does it work?