Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Cosmo Router

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.

Getting Started

Prerequisites

Use the .env.example file to create a .env file with the specified environment variables.

make dev

Code Generation

Code is committed to the repository, but if you want to regenerate the code, run the command in the root of the repository:

make generate-go

Develop with a local Engine version

You 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

Build your own Router

See Router Customizability how to build your own router.

Architecture

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.