Using mock APIs to create a federated GraphQL API.
users
subgraph, a products
subgraph and a review
subgraph.
The schemas for each subgraph are below:
Users
Products
Reviews
supergraph-config.yaml
.
Rover will use this file to run a supergraph that will call our mock subgraphs.
Paste the following config into the file, replacing the subgraph_url
values with the URLs of your subgraph mock APIs:
http://localhost:4000
).
Navigate to your supergraph’s address in your browser where you’ll be greeted with the Apollo Sandbox.
Execute some queries to your supergraph and observe that your subgraph mocks are receiving requests.
To stop your supergraph, enter Ctrl
+ C
in your terminal window where rover is running.
You have successfully creating a GraphQL Federation supergraph, powered by subgraphs running in WireMock Cloud!
For more information on the concepts of GraphQL Federation and designing subgraph schemas, see the official GraphQL
documentation,
as well as the Apollo Federation
documentation.
If you have feedback or questions on our GraphQL functionality as it evolves, we’d love to hear from you.
Please get in touch.