Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/async-graphql/graphgate
https://github.com/async-graphql/graphgate
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/async-graphql/graphgate
- Owner: async-graphql
- License: mpl-2.0
- Created: 2021-03-04T02:05:06.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-10-11T17:43:22.000Z (11 months ago)
- Last Synced: 2024-06-21T16:09:08.129Z (3 months ago)
- Language: Rust
- Size: 400 KB
- Stars: 179
- Watchers: 8
- Forks: 26
- Open Issues: 5
-
Metadata Files:
- Readme: README-cn.md
- License: LICENSE
Awesome Lists containing this project
- awesome-list - graphgate - graphql | 105 | (Rust)
README
# GraphGate
GraphGate 是一个用 Rust 语言实现的 [Apollo Federation](https://www.apollographql.com/apollo-federation) 网关。
## 快速体验
一个由3个服务(accounts, products, reviews)组成的完整GraphQL API。
```shell
docker run -p 8000:8000 scott829/graphgate-standalone-demo:latest
```打开浏览器[http://localhost:8000](http://localhost:8000)
### 执行查询
```graphql
{
topProducts {
upc name price reviews {
body
author {
id
username
}
}
}
}
```### 执行订阅
```graphql
subscription {
users {
id username reviews {
body
}
}
}
```## FAQ
### Apollo Federation 是做什么的?
在微服务架构中数据可能位于不同的位置,把多个服务提供的 API 合并到一起是一件有挑战的事情。
为了解决这个问题,你可以使用 Federation 将API的实现划分为多个可组合服务:
与其他分布式 GraphQL 结构(例如模式缝合)不同,Federation 使用声明性编程模型,该模型使每个服务仅实现图中负责的部分。
### 为什么要用 Rust 实现它?
Rust是我最喜欢的编程语言,它安全并且快速,非常适合用于开发API网关这样的基础服务。
### GraphGate和Apollo Federation的主要区别是什么?
我猜GraphGate的性能会好很多(我还没有做基准测试,但很快会加上),并且**支持订阅**。