1.8 KiB
1.8 KiB
Simple Todo App
This is a simple Todo API application built with FastAPI and SQLite.
Features
- Create, Read, Update, and Delete Todo items
- Health check endpoint
- Database migrations using Alembic
- SQLite database for data storage
Project Structure
.
├── alembic/ # Database migration files
├── app/ # Application package
│ ├── database/ # Database configuration and session management
│ ├── models/ # SQLAlchemy ORM models
│ ├── routers/ # API route handlers
│ └── schemas/ # Pydantic models for request/response validation
├── alembic.ini # Alembic configuration
├── main.py # Application entry point
└── requirements.txt # Project dependencies
Installation
- Clone the repository:
git clone <repository-url>
cd simpletodoapp
- Create a virtual environment and activate it:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
Database Setup
- Run database migrations:
alembic upgrade head
Running the Application
Start the application with Uvicorn:
uvicorn main:app --reload
The API will be available at http://localhost:8000
API Documentation
Once the application is running, you can access the Swagger UI documentation at:
API Endpoints
Health Check
- GET
/health
: Check the application health status
Todo Endpoints
- GET
/todos
: List all todos - POST
/todos
: Create a new todo - GET
/todos/{todo_id}
: Get a specific todo by ID - PATCH
/todos/{todo_id}
: Update a specific todo - DELETE
/todos/{todo_id}
: Delete a specific todo