Files
Genarrative/server-rs/apps/api-server/README.md

35 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# api-server 主工程 package 占位说明
日期:`2026-04-20`
## 1. package 职责
`api-server` 是新后端的 Axum 主工程 package后续负责
1. `main.rs` 启动入口
2. `Router` 装配
3. `with_state` 共享状态注入
4. 中间件挂载
5. `/healthz``/api/*`、SSE 与静态资源兼容层装配
## 2. 当前阶段说明
当前提交仅完成目录占位,不提前进入具体实现。
后续与本 package 直接相关的任务包括:
1. 搭建 `main.rs` / `Router` / `with_state`
2. 接入统一配置加载
3. 接入统一日志与 tracing
4. 接入 `request_id`
5. 接入统一错误处理中间件
6. 接入 response envelope
7. 接入 `/healthz`
## 3. 边界约束
1. `api-server` 负责 HTTP、SSE、Cookie、Header、路由与协议装配。
2. 业务逻辑优先通过独立模块 package 暴露能力,再由主工程组合。
3. 外部副作用通过 `platform-auth``platform-oss``platform-llm` 与各模块 package 的应用层完成。
4. 不把领域规则直接堆在 handler 中。