首页/ AI 技能 / @skilllib/skill-2014279386202058755
Skill站外收录 @skilllib/skill-2014279386202058755

add-admin-api-endpoint

为 Ghost 管理后台 API 新增端点,支持在 ghost/api/admin/ 路径下扩展功能接口,涵盖控制器定义、路由注册及端到端测试验证全流程。

0.0 (0) 628 次安装 原作者 编程导航
收录于 2026-01-22
软件开发 AI 技能

Skills.MD

# Create Admin API Endpoint ## Instructions 1. If creating an endpoint for an entirely new resource, create a new endpoint file in `ghost/core/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/core/server/web/api/endpoints/admin/routes.js`. 4. Add basic `e2e-api` tests for the endpoint in `ghost/core/test/e2e-api/admin` to ensure the new endpoints function as expected. 5. Run the tests and iterate until they pass: `cd ghost/core && yarn 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).

评论 0

还没有评论,来抢沙发。