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: "标签聚合(含各标签文章数)", }, ], }); });