1.8 KiB
1.8 KiB
Simple Todo App
A RESTful API for managing todo items, built with FastAPI and SQLite.
Features
- Create, read, update, and delete todo items
- SQLite database with SQLAlchemy ORM
- Alembic for database migrations
- Health check endpoint
- API documentation with Swagger UI
Prerequisites
- Python 3.9+
- Pip package manager
Project Structure
simpletodoapp/
├── app/
│ ├── database/ # Database connection and session management
│ ├── models/ # SQLAlchemy ORM models
│ ├── routers/ # FastAPI route definitions
│ └── schemas/ # Pydantic schemas for request/response validation
├── migrations/ # Alembic migrations
├── alembic.ini # Alembic configuration
├── main.py # Application entry point
├── pyproject.toml # Project configuration
└── requirements.txt # Project dependencies
Installation
- Clone the repository:
git clone <repository-url>
cd simpletodoapp
- Install the dependencies:
pip install -r requirements.txt
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 interactive API documentation:
- Swagger UI:
http://localhost:8000/docs
- ReDoc:
http://localhost:8000/redoc
API Endpoints
Health Check
GET /health
- Check the health of the service
Todo Operations
POST /api/todos
- Create a new todo itemGET /api/todos
- Get all todo itemsGET /api/todos/{todo_id}
- Get a specific todo itemPUT /api/todos/{todo_id}
- Update a todo itemDELETE /api/todos/{todo_id}
- Delete a todo item
License
MIT