Reputation: 2166
We're currently investigating using GraphQL as a gateway interface for our microservices based architecture. The current architecture is based on CQRS and REST were a lot of views are optimized for the UI. These views are typically updated asynchronously with various events from various microservices (bounded contexts).
In order to support the UI and cutback chattiness, responses contain fully enriched models, for example a post contains a full user profile. With graphql would this mean we no longer have to materialize/denormalize as much as possible?
Upvotes: 2
Views: 1610
Reputation: 432
Yes, a strength of GraphQL compared to REST is that the client chooses what data to receive in response to a request. The server simply makes its data available for queries, allowing the client to ask for data it needs. This allows a decoupling between implementation details on the client and the server's response.
For example, you no longer need to decide whether the full cart should be returned when a product is added - leave that decision to the client.
Upvotes: 5