
- Created project structure and FastAPI application - Added SQLite database models and Pydantic schemas - Implemented todo routes (add, list, delete) - Set up Alembic migrations - Added health endpoint generated with BackendIM... (backend.im)
74 lines
1.6 KiB
Markdown
74 lines
1.6 KiB
Markdown
# Simple Todo App
|
|
|
|
A simple todo application built with FastAPI and SQLite for managing todo items.
|
|
|
|
## Features
|
|
|
|
- Add new todo items
|
|
- List all todo items
|
|
- Mark todo items as complete
|
|
- Delete todo items
|
|
- Health check endpoint
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
simpletodoapp/
|
|
├── alembic/ # Database migration files
|
|
├── app/ # Application code
|
|
│ ├── api/ # API endpoints
|
|
│ ├── database/ # Database connection and sessions
|
|
│ ├── models/ # SQLAlchemy models
|
|
│ ├── schemas/ # Pydantic schemas
|
|
│ └── storage/ # Database storage
|
|
├── main.py # Entry point
|
|
├── alembic.ini # Alembic configuration
|
|
└── requirements.txt # Dependencies
|
|
```
|
|
|
|
## Installation
|
|
|
|
1. Clone the repository:
|
|
|
|
```bash
|
|
git clone <repository-url>
|
|
cd simpletodoapp
|
|
```
|
|
|
|
2. Install dependencies:
|
|
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
3. Run database migrations:
|
|
|
|
```bash
|
|
alembic upgrade head
|
|
```
|
|
|
|
## Running the Application
|
|
|
|
Start the application with Uvicorn:
|
|
|
|
```bash
|
|
uvicorn main:app --reload
|
|
```
|
|
|
|
The API will be available at http://localhost:8000
|
|
|
|
## API Endpoints
|
|
|
|
- `GET /health` - Health check endpoint
|
|
- `GET /todos` - List all todos
|
|
- `POST /todos` - Create a new todo
|
|
- `GET /todos/{todo_id}` - Get a specific todo
|
|
- `PATCH /todos/{todo_id}` - Update a todo
|
|
- `DELETE /todos/{todo_id}` - Delete a todo
|
|
|
|
## API Documentation
|
|
|
|
FastAPI automatically generates API documentation:
|
|
|
|
- Swagger UI: http://localhost:8000/docs
|
|
- ReDoc: http://localhost:8000/redoc |