
- Setup FastAPI project structure - Create SQLAlchemy models and database connection - Implement Alembic migrations - Create CRUD operations for todos - Add API endpoints for todos - Add health endpoint - Update README.md generated with BackendIM... (backend.im)
67 lines
1.6 KiB
Markdown
67 lines
1.6 KiB
Markdown
# Simple Todo App
|
|
|
|
A simple Todo API built with FastAPI and SQLite.
|
|
|
|
## Features
|
|
|
|
- RESTful API for managing todo items
|
|
- SQLite database for data storage
|
|
- Alembic migrations
|
|
- CRUD operations for todos
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
.
|
|
├── alembic/ # Database migrations
|
|
│ └── versions/ # Migration scripts
|
|
├── app/ # Application package
|
|
│ ├── api/ # API endpoints
|
|
│ ├── core/ # Core components
|
|
│ ├── crud/ # CRUD operations
|
|
│ ├── db/ # Database components
|
|
│ ├── models/ # SQLAlchemy models
|
|
│ └── schemas/ # Pydantic schemas
|
|
├── alembic.ini # Alembic configuration
|
|
├── main.py # Application entry point
|
|
└── requirements.txt # Dependencies
|
|
```
|
|
|
|
## API Endpoints
|
|
|
|
- `GET /api/v1/todos` - List all todos
|
|
- `POST /api/v1/todos` - Create a new todo
|
|
- `GET /api/v1/todos/{todo_id}` - Get a specific todo
|
|
- `PUT /api/v1/todos/{todo_id}` - Update a todo
|
|
- `DELETE /api/v1/todos/{todo_id}` - Delete a todo
|
|
- `GET /health` - Health check endpoint
|
|
|
|
## Getting Started
|
|
|
|
### Prerequisites
|
|
|
|
- Python 3.8+
|
|
- pip
|
|
|
|
### Installation
|
|
|
|
1. Clone the repository
|
|
2. Install dependencies:
|
|
```
|
|
pip install -r requirements.txt
|
|
```
|
|
3. Run database migrations:
|
|
```
|
|
alembic upgrade head
|
|
```
|
|
4. Start the application:
|
|
```
|
|
uvicorn main:app --reload
|
|
```
|
|
|
|
## API Documentation
|
|
|
|
Once the application is running, you can access:
|
|
|
|
- Swagger UI: http://localhost:8000/docs
|
|
- ReDoc: http://localhost:8000/redoc |