The router is the component that understands the GraphQL Federation protocol. It is responsible for routing requests to the correct service and for aggregating the responses. It is in connection with the control plane to register itself and to send metrics.
Use the .env.example file to create a .env file with the specified environment variables.
make devCode is committed to the repository, but if you want to regenerate the code, run the command in the root of the repository:
make generate-goYou can uncomment the "replace" directive in the go.mod file to use
the local version of the graphql-go-tools package. Make sure to check out the graphql-go-tools
repository in the same parent directory as the router repository.
replace github.com/wundergraph/graphql-go-tools/v2 => ../../graphql-go-tools/v2
See Router Customizability how to build your own router.
The router is an HTTP server that accepts GraphQL requests and forwards them to the correct service.
The core aka the Engine implements the GraphQL Federation protocol and is responsible for parsing the request, resolving the query and aggregating the responses.
We use Connect to communicate with the controlplane. Connect is framework build on top of gRPC and simplify code-generation and reuse between Studio -> Controlplane <- Router.