4.0.0 • Published 6 months ago

esante-graphql-gtw v4.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

Apollo Federation Gateway for api services in eSante

This is the main entry point for all graphql requests to esante-api, inform-api, insights-api, telehealth-api, and esante-provider.

Updating Subraphs Schemas

The Gateway does NOT resolve automatically at runtime the GraphQL schemas of the subgraphs. This was disabled to avoid the entire gateway crashing when one of the services failed to start.

Instead of leveraging the automatic introspection at runtime the gateway makes use of all the subgraph schema definitions under schemas folder.

It is the job of developers that whenever of the subgraphs schemas changes to come in this repository, regenerate the new subgraph locally and update the appropiate service file!

How to generate a subraph schema file

Generating a subgraph schema file is done with the rover cli from Apollo.

  1. Pull latest changes for the target service repository locally.
  2. ensure you have introspection enabled in .ENV
  3. Start the service locally and ensure it's up and running
  4. In the local esante-gtw-api repository execute the command below. Replace LOCAL-PORT and SERVICE-ID appropriately.
    ./node_modules/.bin/rover subgraph introspect http://localhost:<LOCAL-PORT>/graphql --header "tenantid: <TENANT-ID>" > ./schemas/<SERVICE-ID>.graphql
    .

./node_modules/.bin/rover subgraph introspect http://localhost:/graphql --header "tenantid: " > ./schemas/.graphql