2025-05-17 02:34:44 +00:00

112 lines
2.3 KiB
Markdown

# Simple Todo App
A simple Todo API built with FastAPI and SQLite.
## Features
- Create, read, update, and delete todo items
- Filter todos by completion status
- Health check endpoint for application status
- SQLite database with SQLAlchemy ORM
- API documentation with Swagger UI and ReDoc
## Getting Started
### Prerequisites
- Python 3.7+
- pip (Python package manager)
### Installation
1. Clone the repository:
```bash
git clone <repository-url>
cd simpletodoapp-ev72zr
```
2. Install dependencies:
```bash
pip install -r requirements.txt
```
3. Apply database migrations:
```bash
alembic upgrade head
```
4. Start the development server:
```bash
uvicorn main:app --reload
```
The API will be available at http://localhost:8000
## API Documentation
After starting the server, you can access the API documentation at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
## API Endpoints
### Todo Endpoints
- **GET /api/v1/todos**: List all todos
- Query Parameters:
- `skip`: Number of records to skip (pagination)
- `limit`: Maximum number of records to return
- `completed`: Filter by completion status (true/false)
- **POST /api/v1/todos**: Create a new todo
- Request Body: JSON with todo details
- **GET /api/v1/todos/{todo_id}**: Get a specific todo by ID
- **PUT /api/v1/todos/{todo_id}**: Update a specific todo
- Request Body: JSON with updated todo details
- **DELETE /api/v1/todos/{todo_id}**: Delete a specific todo
### Health Endpoint
- **GET /api/v1/health**: Check the API health status
## Project Structure
```
.
├── alembic.ini
├── app
│ ├── api
│ │ ├── endpoints
│ │ │ ├── health.py
│ │ │ └── todos.py
│ │ └── routes.py
│ ├── core
│ │ └── config.py
│ ├── db
│ │ ├── deps.py
│ │ └── session.py
│ ├── models
│ │ └── todo.py
│ └── schemas
│ └── todo.py
├── main.py
├── migrations
│ ├── README
│ ├── env.py
│ ├── script.py.mako
│ └── versions
│ └── 01_initial_setup.py
└── requirements.txt
```
## License
This project is licensed under the MIT License.