This demo combines two data sources:
- Countries API https://countries.trevorblades.com/
- UNESCO World Heritage Sites data
The countries API is a publicly available GraphQL API, while the UNESCO data is a small local GraphQL service. The two APIs are stitched into one combined gateway schema. The UNESCO app configures merged types using schema directives, while the Countries API (which we do not control) uses static merge configuration.
yarn install
yarn start
The following services are available:
- Stitched gateway: http://localhost:4000/graphql
- UNESCO API: http://localhost:4001/graphql
- Countries API: https://countries.trevorblades.com
Go to the Countries API and check out some country data:
query {
countries {
code
name
emoji
phone
capital
}
}
Next go to the UNESCO API and look at some UNESCO site data, which includes an extremely primitive version of the Country
:
query {
unescoSite(id: 1478) {
name
lat
lon
countries {
code
unescoSites {
name
}
}
}
}
Now go to the stitched gateway and see the same query with data from the Countries API stitched into it:
query {
unescoSite(id: 1478) {
name
lat
lon
countries {
code
name
emoji
phone
capital
unescoSites {
name
}
}
}
}
Alternatively within the stitched gateway, try fetching a country from the Countries API and note that you can access UNESCO sites from it:
query {
country(code: "DE") {
name
emoji
unescoSites {
id
name
}
}
}