GraphQL is a powerful and relatively new paradigm that can greatly enhance your API offerings, and now it is possible to create a GraphQL API on the Layer7 API Gateway using Arvata Euclid.
There are 4 prerequisites to deploy a GraphQL server to a Layer7 API Gateway. Let’s take a look at each.
#1: The Data Model (AKA the “SDL” or “Schema”)
This is the document that represents the contract the client has with the server, and is similar to a WSDL in SOAP.
#2: Resolver Logic
“Resolvers” are simple functions that specify how to retrieve or modify data from the back-end connector. We leverage Apache Freemarker as our language of choice for it’s performance, flexibility, and security benefits.
#3: A Gateway
We transform your existing Layer7 API Gateway into a GraphQL server, with no need for additional runtime infrastructure.
#4: Connectivity to Data-Sources
Any necessary details on how to connect to data-sources such as REST/SOAP APIs, SQL databases, or anywhere else that your data lives. Ensure that your gateway above has access to these data-sources.
Once we have the items above, we can define/upload them to Euclid. At a high level, these steps are:
- Select a previously on-boarded gateway or onboard a new one
- Define back-end “connectors” and create an “environment” to reference these connectors
- Using the euclid-cli utility, create an “executable schema” (AKA “bundle”), and upload it as a “Schema”
- Deploy an endpoint by selecting the gateway, environment, schema, and other ancillary configurations
At this point, we have a GraphQL server running on the Gateway! Just give the endpoint to your client and they can start interacting with it based on the contract you’ve defined.