Here we post product updates and publish articles on topics such as digital publishing, content strategy, and software development.
Be sure also to check out our Product Changelog for more news!
Building a modern app requires an approach that might be both server-side (for a fast initial render) and client-side (to increase the response time of any user interaction) to guarantee the best chance of success for an app.
Using an enabled React SSG (e.g. Gatsby) has been one of the most effective solutions so far but connecting it to traditional JSON REST APIs is not an efficient solution.
GraphQL offers application creators the possibility to access data the way they want, instead of having to adhere to what is provided by a traditional JSON REST API.
For example, a social app may need a user's avatar and a list of followers with their latest status, in GraphQL you need just one query, and you get exactly what you asked for. You don't need to make a series of queries to different endpoints, as you do with REST. You only need one query to get the same data you would from multiple REST APIs.
Another advantage is how changes are handled through time. Modifications to REST API often require changes that are not backwardly compatible, so clients have to request a specific version when making calls. In GraphQL, breaking changes can mostly be avoided, simply by adding new data as needed and minimizing removal.
To discover what you can do when you use GraphQL for your DatoCMS project you can start from our introduction on the content delivery API: https://www.datocms.com/docs/content-delivery-api/
In order to be able to query exactly what you want to find, you can learn how to query single and multiple records here