Why GraphQL?

GraphQL is a server-side query language and runtime you can use to expose your APIs as an alternative to REST APIs. GraphQL allows you to request only the data you want and handle any subsequent requests on the server side, saving numerous expensive origin-to-client requests by instead handling requests in your internal network.

Using GraphQL in an API gateway

API gateways, such as Gloo Mesh Gateway, expose microservices with different implementations from a single location and schema. The API gateway acts like a single owner for all requests and responses. As such, it can shape traffic according to consistent policies that you set. When you integrate with with GraphQL, you get the benefits of an API gateway, a service mesh, and more. GraphQL exposes your API to allow clients to interact with the API on their own terms. Additionally, you can mix and match your GraphQL graph with your existing REST routes. This setup lets you test and migrate to GraphQL at a pace that makes sense for your organization.

Gloo Mesh Enterprise extends API gateway and GraphQL capabilities with route-level control. Usually, API gateways apply edge networking logic at the route level. For example, the gateway might rate limit, authorize, and authenticate requests. Most GraphQL servers are a separate endpoint behind the API gateway. Therefore, you cannot add route-level customizations. In contrast, Gloo Mesh and Gloo Mesh Gateway embed route-level customization logic into the API gateway.

Get started

To set up GraphQL in your Gloo environment, check out the GraphQL guides in the Gloo Mesh Gateway documentation. These guides apply to both Gloo Mesh Gateway and Gloo Mesh for setting up your GraphQL integration. If you do not have a Gloo Mesh Gateway license in addition to your Gloo Mesh license, you can follow the east-west routing examples when setting up routing to your GraphQL servers. In Gloo Mesh, the GraphQL server executes within the Istio sidecar of the mesh-internal client, rather than requiring the request to be routed out of your Gloo Mesh cluster, through the gateway, and back into the cluster.