健康检查 API
检查服务健康状态及 KV 存储可用性。响应遵循 JSON:API 规范。
❤️ 接口信息
- 接口路径:
/health - 请求方法:
GET - 响应格式: JSON(
application/vnd.api+json)
🚀 快速开始
基础调用
bash
curl https://api.160621.xyz/v1/health成功响应 200
json
{
"jsonapi": { "version": "1.0" },
"data": {
"type": "health",
"id": "service",
"attributes": {
"status": "healthy",
"timestamp": "2026-07-13T12:00:00.000Z",
"kvStorage": "available",
"env": "production"
}
}
}错误响应
服务不可用时返回 503:
json
{
"jsonapi": { "version": "1.0" },
"errors": [
{
"status": "503",
"code": "SERVICE_UNAVAILABLE",
"title": "服务不可用",
"detail": "错误信息"
}
]
}📋 响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
status | string | 服务状态(healthy) |
timestamp | string | 服务时间戳 |
kvStorage | string | KV 存储状态(available / not configured) |
env | string | 运行环境标识 |
⚙️ 环境变量
| 变量 | 说明 |
|---|---|
KV_DEFAULT | 检测 KV 存储是否可用 |
testenv | 环境标识(通过 env.testenv 读取) |