feat(backend): establish gin sqlite service skeleton

This commit is contained in:
QiuSW
2026-07-25 22:29:56 +08:00
parent 84f2da3cf7
commit ab21219a07
32 changed files with 1854 additions and 42 deletions
+21
View File
@@ -40,6 +40,27 @@ HTTP 语义:
- `429` 频率限制
- `503` 依赖暂不可用
## 服务健康
### `GET /healthz`
不需要业务身份,只检查进程和 SQLite 连接,不返回版本、路径、DSN、连接池统计或内部
错误。响应带 `Cache-Control: no-store`,默认不返回 CORS header。
数据库可用:
```json
{"status":"ok"}
```
返回 `200`。数据库不可用时返回 `503`:
```json
{"status":"unavailable"}
```
健康检查失败不能终止进程;未知路由和不允许的方法分别使用稳定 `404`/`405` JSON。
## 认证
### 管理 Web 会话