fastapi-crud-api/docs/plans/2026-05-07-fastapi-example-plan.md
root 67d8c6bf30 feat: add FastAPI example project with CRUD API
- Add FastAPI application with health check and item CRUD endpoints
- Add Pydantic models for request/response validation
- Add pytest test suite with 5 passing tests
- Add project documentation and run script

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 08:25:34 +08:00

39 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# FastAPI 示例项目实现计划
日期2026-05-07
## 目标
搭建一个最小可运行的 FastAPI REST API 示例项目。
## 任务清单
### 批次 1项目基础
| # | 任务 | 文件 | 验证 | 预计时间 |
|---|------|------|------|----------|
| 1 | 创建 requirements.txt | requirements.txt | 文件存在 | 1min |
| 2 | 创建项目目录结构 | app/, tests/ | 目录存在 | 1min |
| 3 | 编写数据模型 | app/models.py | 导入成功 | 2min |
### 批次 2核心实现TDD
| # | 任务 | 文件 | 验证 | 预计时间 |
|---|------|------|------|----------|
| 4 | 写失败测试:健康检查 | tests/test_api.py | pytest FAIL | 2min |
| 5 | 实现健康检查端点 | app/main.py | pytest PASS | 2min |
| 6 | 写失败测试CRUD | tests/test_api.py | pytest FAIL | 3min |
| 7 | 实现 CRUD 端点 | app/routes.py | pytest PASS | 5min |
### 批次 3收尾
| # | 任务 | 文件 | 验证 | 预计时间 |
|---|------|------|------|----------|
| 8 | 添加启动脚本 | run.sh | 脚本可执行 | 1min |
| 9 | 更新文档 | README.md | 文件存在 | 2min |
## 验证命令
- 单测:`pytest tests/ -v`
- 启动:`uvicorn app.main:app --reload`
## 完成标准
- [ ] 所有测试通过
- [ ] API 可启动并响应
- [ ] 代码已提交