router

module
v0.0.0-...-75bbcb3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2024 License: Apache-2.0

README

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, you can run the command in the root of the repository:

make generate-go

Build your own Router

See Router Customizability how to build your own router.

Architecture

The router is a 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.

Directories

Path Synopsis
cmd
gen
internal
cdn
docker
Package docker implements helper functions we use while running under Docker.
Package docker implements helper functions we use while running under Docker.
jwt
profile
Package profile implements functions for profiling the router
Package profile implements functions for profiling the router
pkg
art
authentication
Package authentication implements the types and functions used to load and validate user authentication
Package authentication implements the types and functions used to load and validate user authentication
config
Package loadvariable implements helper functions for retrieving values from wgpb.ConfigurationVariable instances.
Package loadvariable implements helper functions for retrieving values from wgpb.ConfigurationVariable instances.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL