task_auto_plan/README.md

48 lines
953 B
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 的简单待办事项Todo管理服务使用内存假数据存储。
## 功能
- 获取所有待办事项列表
- 根据 ID 获取单个待办事项
- 创建新的待办事项
- 更新待办事项
- 删除待办事项
## 安装依赖
```bash
cd codegen-runs/codegen_a2cef5070965479b93c5b3c07d4c8216
pip install -r requirements.txt
```
## 启动服务
```bash
uvicorn app.main:app --reload --port 8000
```
访问 http://127.0.0.1:8000/docs 查看自动生成的 API 文档Swagger UI
## 运行测试
```bash
cd codegen-runs/codegen_a2cef5070965479b93c5b3c07d4c8216
pytest tests/ -v
```
## 快速验证
启动服务后,在另一个终端执行:
```bash
# 获取所有待办事项
curl http://127.0.0.1:8000/todos
# 创建新待办事项
curl -X POST http://127.0.0.1:8000/todos \
-H "Content-Type: application/json" \
-d '{"title": "学习 FastAPI", "completed": false}'
```