Back to .md Directory
globs: ["src/app/api//*", "src/api//*"]
API 开发规则
接口规范
- 所有接口返回统一格式:{ code: number, data: T, message: string }
- 错误码:400 参数错误 / 401 未认证 / 403 无权限 / 500 服务器错误
- 参数校验用 Zod,在 Controller 层完成
安全
- 敏感接口必须校验权限
- 用户输入必须做 sanitize
- 不要在响应里返回敏感字段(密码、token 等)
命名
- GET /api/资源名(复数)— 列表
- GET /api/资源名/:id — 详情
- POST /api/资源名 — 创建
- PATCH /api/资源名/:id — 更新
- DELETE /api/资源名/:id — 删除
Related Documents
cursor-rules.md
dbt Core
Defines a complete dbt project setup with layered architecture, SQL style, Jinja best practices, and CI/CD workflow guidance.
ai
0
5
agbackhoffcursor-rules.md
HarmonyOS 主题与样式 - Cursor Rules
Defines HarmonyOS theming rules for dark/light mode, page brightness, and screen-on control with code examples.
aicursor
0
5
skindhucursor-rules.md
Cursor Development Environment
Documents a Docker-based dev container setup with test commands and OpenClaw agent configuration for the ClawDrive project.
aiagentrag
0
4
CyberImmortalcursor-rules.md
Journey from Concept to Code: Transforming Cursor into a Devin-like AI Assistant
Documents the creation of aicode.cursorrules, a set of rules that turns Cursor/Windsurf into a Devin-like AI assistant with automated planning and self-evolution.
aiagentllm
0
4
wanghaisheng