78 lines
1.8 KiB
Markdown
78 lines
1.8 KiB
Markdown
# 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
|
|
|
|
1. Clone the repository:
|
|
```bash
|
|
git clone <repository-url>
|
|
cd simpletodoapp
|
|
```
|
|
|
|
2. Install the dependencies:
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
## Running the Application
|
|
|
|
Start the application with Uvicorn:
|
|
|
|
```bash
|
|
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 item
|
|
- `GET /api/todos` - Get all todo items
|
|
- `GET /api/todos/{todo_id}` - Get a specific todo item
|
|
- `PUT /api/todos/{todo_id}` - Update a todo item
|
|
- `DELETE /api/todos/{todo_id}` - Delete a todo item
|
|
|
|
## License
|
|
|
|
MIT |