Working with Mesh means dealing with 4 main concepts: Sources, Handlers, Transforms and Unified Schema:
- In Mesh, a sub-service (GraphQL API, REST API) is called a Source.
- Sources are translated to GraphQL Schemas with the appropriate Handler.
- All Sources' GraphQL Schema are merged into a final Unified Schema.
- Finally, if applicable, configured transformations, called Transforms, are applied to the Unified Schema.
The above GraphQL Mesh Gateway has 3 configured Sources:
- The "City" Source configured with the
- The "Population" Source configured with the
- The "Weather" Source configured with the
Sources, Handlers, Transforms are configured in a
configuration file that defines:
- How to fetch the definition of the sub-services (GraphQL API, REST API, and more)
- What transformations should be applied to the unified schema (optional)
- The path to the declaration of custom resolvers (optional)
- Which cache strategy should be used? (optional)
- Which envelop plugins should be loaded and configured at the server level? (optional)
Let's have a closer look to a
.mesh.yaml configuration file by
installing Mesh and
building our first Gateway!