When and How to use GraphQL with Microservice Architecture

前端 未结 9 1044
遇见更好的自我
遇见更好的自我 2021-01-29 17:13

I\'m trying to understand where GraphQL is most suitable to use within a Microservice architecture.

There is some debate about having only 1 GraphQL schema that works as

9条回答
  •  温柔的废话
    2021-01-29 17:55

    See the article here, which says how and why approach #1 works better. Also look at the below image taken from the article I mentioned:

    One of the main benefits of having everything behind a single endpoint is that data can be routed more effectively than if each request had its own service. While this is the often touted value of GraphQL, a reduction in complexity and service creep, the resultant data structure also allows data ownership to be extremely well defined, and clearly delineated.

    Another benefit of adopting GraphQL is the fact that you can fundamentally assert greater control over the data loading process. Because the process for data loaders goes into its own endpoint, you can either honor the request partially, fully, or with caveats, and thereby control in an extremely granular way how data is transferred.

    The following article explains these two benefits along with others very well: https://nordicapis.com/7-unique-benefits-of-using-graphql-in-microservices/

提交回复
热议问题