fastapi-crud-api/README.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

694 B

FastAPI Example

一个最小化的 FastAPI REST API 示例项目。

快速开始

# 创建虚拟环境并安装依赖
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

# 启动服务
./run.sh

# 或直接运行
uvicorn app.main:app --reload

API 端点

方法 路径 描述
GET /health 健康检查
GET /items 列出所有项目
POST /items 创建新项目
GET /items/{id} 获取单个项目

测试

source .venv/bin/activate
pytest tests/ -v

API 文档

启动服务后访问: