This is the GraphQL gateway used by Parlio.
The diagram below illustrates the environment in which the gateway operates.
flowchart LR
F(Frontend/Client)-->|HTTP| G{Gateway}
subgraph S [Services]
TK[Tweede Kamer API]
end
G -->|HTTP| TK
click F "https://github.com/parlio-nl/parlio-frontend" _blank
click G "https://github.com/parlio-nl/parlio-gateway" _self
click TK "https://github.com/parlio-nl/parlio-backend" _blank
Please install Yarn via npm install -g yarn
.
The node_modules
folder can be created by running yarn install
.
Running the development environment requires three separate commands (probably in different terminal windows):
- Use
tsc:watch
to start the TypeScript compiler in watch mode - Use
supergraph:watch
to watch for changes in therover/subgraphs
folder, orrover/config/development.yaml
configuration - Use
yarn dev
to start the development environment usingnodemon
The Rover CLI is a tool created by Apollo
to facilitate schema introspection
and federated graph composition. The Rover CLI must
be installed manually and is not installed by running yarn install
.
The gateway uses Apollo Federation 2. You may need
to install the rover-fed2
plugin
.
To use Rover CLI with PowerShell we must configure UTF-8.
This step is not necessary when using PowerShell Core.
$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8
$PSDefaultParameterValues['*:Encoding'] = 'utf8'
rover subgraph introspect http://localhost:8080/graphql > rover/subgraph/my-subgraph-name.graphql
Individual schema can be composed into a supergraph by running yarn supergraph:prod
(for production changes)
or yarn supergraph:dev
(for development changes).
The configuration files for these two composition operations live in the rover/config
folder.
Please run yarn fmt
before committing.