This repository contains a demo of WunderGraph Cosmo Federation capabilities. It showcases to implement subgraphs in TypeScript and Go and how to compose them into a federated graph.
It uses the command-line wgc
to compose a federated schema from multiple subgraphs and the Cosmo Router
to run the Federated Graph.
We made it easy to get started with the demo. Just follow the steps below.
- Install the dependencies
npm install
npm start
Finally, go to http://localhost:3002 and try out the example query ./example-queries.graphql
!
You can also run subgraphs in Go. To do so, you need to have the Go toolchain installed.
npm start-go
You can update the subgraph schemas and regenerate the router configuration by running:
npm run compose
# or
npm run compose-go
This will require a restart of the router so press CTRL+C
and run npm start
again.
💫 If you would like to learn more about federation, check out the WunderGraph Cosmo Documentation!