chore: initial commit of ai site platform
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
43
gateway/README.md
Normal file
43
gateway/README.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# 网关
|
||||
|
||||
统一入口:**默认用 Go 网关(本机 :8180)**;Docker 就绪后可切 APISIX(:9080)。
|
||||
|
||||
## 路由
|
||||
|
||||
| 对外路径 | 上游 |
|
||||
|----------|------|
|
||||
| `/api/v1/*` | platform `:8888` |
|
||||
| `/ai/*` | AI `:8001`(去掉 `/ai` 前缀) |
|
||||
| `/gateway/health` | 网关健康检查 |
|
||||
|
||||
JWT 仍由中台校验;网关负责反代、CORS、限流、`X-Request-Id` / `X-Gateway`。
|
||||
|
||||
## 1)Go 网关(推荐本地)
|
||||
|
||||
```powershell
|
||||
# 先启动 platform + ai-service
|
||||
cd gateway
|
||||
go mod tidy
|
||||
go run . -f etc/gateway.yaml
|
||||
```
|
||||
|
||||
探测:
|
||||
|
||||
```powershell
|
||||
curl http://127.0.0.1:8180/gateway/health
|
||||
curl -X POST http://127.0.0.1:8180/api/v1/auth/login -H "Content-Type: application/json" -d "{\"username\":\"demo\",\"password\":\"demo123\"}"
|
||||
```
|
||||
|
||||
前端 `vite` 已代理到 `8180`。
|
||||
|
||||
## 2)APISIX(Docker)
|
||||
|
||||
先启动 Docker Desktop,再:
|
||||
|
||||
```powershell
|
||||
cd gateway
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
入口:`http://127.0.0.1:9080`
|
||||
路由见 `apisix/apisix.yaml`(`host.docker.internal` 访问宿主机服务)。
|
||||
Reference in New Issue
Block a user