From e4a5f8059ae793f6dca3e9969e46799ab21e7b91 Mon Sep 17 00:00:00 2001 From: wonder Date: Sat, 23 May 2026 12:19:53 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=96=87=E6=A1=A3=20/health?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/api.md | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 docs/api.md diff --git a/docs/api.md b/docs/api.md new file mode 100644 index 0000000..6d238fb --- /dev/null +++ b/docs/api.md @@ -0,0 +1,62 @@ +# gen2d API 文档 + +Base URL: `http://localhost:8080` + +## 统一响应格式 + +所有接口均返回以下 JSON 结构: + +```json +{ + "code": 0, + "message": "ok", + "data": {} +} +``` + +| 字段 | 类型 | 说明 | +| --------- | ------ | -------------------------------------- | +| `code` | int | 业务状态码。`0` 表示成功,非零为错误码 | +| `message` | string | 状态描述 | +| `data` | any | 响应数据,错误时可能不返回此字段 | + +### 成功响应 + +```json +{ + "code": 0, + "message": "ok", + "data": { ... } +} +``` + +### 错误响应 + +```json +{ + "code": 400, + "message": "error description" +} +``` + +--- + +## 接口列表 + +### 健康检查 + +``` +GET /api/v1/health +``` + +**响应示例** + +```json +{ + "code": 0, + "message": "ok", + "data": { + "status": "healthy" + } +} +```