https://github.com/graphql-portal/gateway-usage-example
https://github.com/graphql-portal/gateway-usage-example
Last synced: 16 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/graphql-portal/gateway-usage-example
- Owner: GraphQL-Portal
- Created: 2021-02-01T13:37:13.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-01-07T23:12:00.000Z (over 3 years ago)
- Last Synced: 2025-10-22T15:08:07.403Z (8 months ago)
- Language: JavaScript
- Size: 1.3 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Gateway usage example
The example shows how to setup configs for the gateway to merge different services into single GraphQL endpoint.
## External dependencies
### Redis
You should have a correct endpoint to a running Redis instance in `./config/gateway.yaml:redis_connection_string`.
## Run
Install dependencies: `yarn`\
Start services to merge: `yarn start-services`\
Start the gateway: `yarn start` (or `portal` if you have installed it globally)
## Details
There are three example services: user and product services are independent, order service manages the relation between users and products.\
User and product service APIs are described using OpenAPI(Swagger) yaml-documents, Order API endpoint is described using JSONSchema.\
Each service has its own config in `./config/sources/`, they are described using [graphql-mesh](https://github.com/Urigo/graphql-mesh) handler's subset of config.\
Services are merged in an API `./config/apis/api.yaml`.\
Api config has additional definitions and resolver.\
Resolver `./resolvers/orders.js` defines how the gateway will merge data from different services into one GraphQL type.\
Other types are generated in runtime using graphql-mesh.