Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/graphql-portal/gateway-usage-example
https://github.com/graphql-portal/gateway-usage-example
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/graphql-portal/gateway-usage-example
- Owner: GraphQL-Portal
- Created: 2021-02-01T13:37:13.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-01-07T23:12:00.000Z (almost 2 years ago)
- Last Synced: 2024-04-24T10:42:18.845Z (8 months ago)
- Language: JavaScript
- Size: 1.3 MB
- Stars: 1
- Watchers: 2
- 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.