Gloo GraphQL module
Create GraphQL APIs directly in Envoy using declarative configuration with Gloo Gateway and Gloo Mesh.
The GraphQL integration in Gloo Gateway requires a Solo Istio image for the gateway.
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 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 GraphQL, you get the benefits of an API gateway 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 Gateway 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 Gateway embeds route-level customization logic into the API gateway.
Review the following video to learn how Gloo Gateway and GraphQL work together to securely expose your APIs.
Check out the following pages to set up GraphQL in your Gloo environment.
Get started: Get started with GraphQL in Gloo Gateway.
Define API schema: Define what kind of data can be returned to a GraphQL query.
Handle GraphQL requests: Choose how GraphQL requests are executed.
Route to GraphQL servers: Set up routing to your GraphQL APIs, and optionally apply GraphQL policies to the routes.
Stitching GraphQL APIs: Stitch multiple schemas together to expose one unified GraphQL server to your clients.
Explore the GraphQL UI: Visualize your GraphQL API and services in the GraphQL UI.
Cache queries: Improve network performance by caching GraphQL queries.
Allow only specific queries: Prevent malicious requests to your GraphQL servers by specifying allowed queries.
Monitor GraphQL health: Gather metrics for your GraphQL services in Prometheus.
When you configure Gloo GraphQL resources, such as
GraphQLSchema CRs, you must include the
clusterName field when you reference schema or resolver maps, even if all your resources are in one cluster. All example resources in the documentation include the
clusterName field, such as in the REST resolvers guide, but be sure to include the
clusterName field when you configure your own resources.