This commit is contained in:
z.ai committed 2026-10-08 11:09:37 +08:00
1 parent c1541b80df
commit b4c7908029
97 files changed
+12403 -154

No files matched your search

+52
View File
@@ -0,0 +1,52 @@
import { ok, withErrorHandling } from "@/lib/api/response";
import { siteConfig } from "@/lib/site-config";
/**
* GET /api —— 接口索引
*
* 列出当前可用的接口,方便开发与调试时快速查看。
* 生产环境可按需移除或限制访问。
*/
export const GET = withErrorHandling(async () => {
return ok({
name: siteConfig.name,
version: "v0.1",
endpoints: [
{
method: "GET",
path: "/api/health",
description: "健康检查(含数据库连通性与延迟)",
},
{
method: "GET",
path: "/api/posts",
description: "文章列表,支持 limit / offset / tag / status / includeDrafts",
},
{
method: "POST",
path: "/api/posts",
description: "新建文章",
},
{
method: "GET",
path: "/api/posts/[slug]",
description: "文章详情(含正文)",
},
{
method: "PATCH",
path: "/api/posts/[slug]",
description: "更新文章(部分更新;PUT 同义)",
},
{
method: "DELETE",
path: "/api/posts/[slug]",
description: "删除文章",
},
{
method: "GET",
path: "/api/tags",
description: "标签聚合(含各标签文章数)",
},
],
});
});