
- Set up project structure with FastAPI - Implement Todo model and database connection - Set up Alembic for database migrations - Create CRUD API endpoints for Todo management - Add health endpoint for application monitoring - Update README with project documentation generated with BackendIM... (backend.im)
69 lines
1.4 KiB
Markdown
69 lines
1.4 KiB
Markdown
# Todo Application
|
|
|
|
A simple Todo application built with FastAPI and SQLite.
|
|
|
|
## Features
|
|
|
|
- Create, read, update, and delete todos
|
|
- Filter todos by completion status
|
|
- Health endpoint for application monitoring
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
/
|
|
├── app/
|
|
│ ├── api/
|
|
│ │ ├── endpoints/
|
|
│ │ │ ├── health.py # Health check endpoint
|
|
│ │ │ └── todos.py # Todo CRUD operations
|
|
│ ├── db/
|
|
│ │ ├── base.py # SQLAlchemy Base
|
|
│ │ └── session.py # Database session management
|
|
│ ├── models/
|
|
│ │ └── todo.py # SQLAlchemy Todo model
|
|
│ └── schemas/
|
|
│ └── todo.py # Pydantic schemas for Todo
|
|
├── alembic/ # Database migrations
|
|
├── main.py # FastAPI application
|
|
└── requirements.txt # Project dependencies
|
|
```
|
|
|
|
## Setup
|
|
|
|
1. Install dependencies:
|
|
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
2. Run migrations:
|
|
|
|
```bash
|
|
alembic upgrade head
|
|
```
|
|
|
|
3. Start the application:
|
|
|
|
```bash
|
|
uvicorn main:app --reload
|
|
```
|
|
|
|
## API Endpoints
|
|
|
|
### Todos
|
|
|
|
- `GET /api/todos`: List all todos
|
|
- `POST /api/todos`: Create a new todo
|
|
- `GET /api/todos/{todo_id}`: Get a specific todo
|
|
- `PUT /api/todos/{todo_id}`: Update a todo
|
|
- `DELETE /api/todos/{todo_id}`: Delete a todo
|
|
|
|
### Health
|
|
|
|
- `GET /health`: Check application health
|
|
|
|
## API Documentation
|
|
|
|
- Swagger UI: `/docs`
|
|
- ReDoc: `/redoc` |