Skip to main content

add-admin-api-endpoint

Add a new endpoint or endpoints to Ghost's Admin API at `ghost/api/admin/**`.

来源信息

仓库
TryGhost/Ghost
最近来源活动
2026年10月9日 14:25
检测到的 SKILL.md 语言
英语
星标
55,512
分支
11,988

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

文件资源管理器
4 个文件

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
Add Admin API Endpoint
description
Add a new endpoint or endpoints to Ghost's Admin API at `ghost/api/admin/**`.
# Create Admin API Endpoint ## Instructions 1. If creating an endpoint for an entirely new resource, create a new endpoint file in `ghost/core/server/api/endpoints/`. Otherwise, locate the existing endpoint file in the same directory. 2. The endpoint file should create a controller object using the JSDoc type from (@tryghost/api-framework).Controller, including at minimum a `docName` and a single endpoint definition, i.e. `browse`. 3. Add routes for each endpoint to `ghost/core/server/web/api/endpoints/admin/routes.js`. 4. Add basic `e2e-api` tests for the endpoint in `ghost/test/e2e-api/admin` to ensure the new endpoints function as expected. 5. Run the tests and iterate until they pass: `cd ghost && pnpm test:single test/e2e-api/admin/{test-file-name}`. ## Reference For a detailed reference on Ghost's API framework and how to create API controllers, see [reference.md](reference.md).
在 GitHub 查看