77 lines
1.6 KiB
Markdown
77 lines
1.6 KiB
Markdown
# Todo App API
|
|
|
|
A simple todo application API built with FastAPI and SQLite.
|
|
|
|
## Features
|
|
|
|
- Create, read, update, and delete todo items
|
|
- Health check endpoint
|
|
- SQLite database with Alembic migrations
|
|
- Pydantic data validation
|
|
- Interactive API documentation
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
todoapp/
|
|
├── app/
|
|
│ ├── api/
|
|
│ │ ├── endpoints/
|
|
│ │ │ ├── health.py
|
|
│ │ │ └── todos.py
|
|
│ │ └── api.py
|
|
│ ├── core/
|
|
│ │ └── config.py
|
|
│ ├── crud/
|
|
│ │ └── todo.py
|
|
│ ├── db/
|
|
│ │ ├── deps.py
|
|
│ │ └── session.py
|
|
│ ├── models/
|
|
│ │ └── todo.py
|
|
│ └── schemas/
|
|
│ └── todo.py
|
|
├── migrations/
|
|
│ ├── versions/
|
|
│ │ └── a3bfb446d052_create_todos_table.py
|
|
│ ├── env.py
|
|
│ └── script.py.mako
|
|
├── alembic.ini
|
|
├── main.py
|
|
└── requirements.txt
|
|
```
|
|
|
|
## Setup
|
|
|
|
1. Clone the repository
|
|
|
|
2. Install dependencies:
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
3. Run the application:
|
|
```bash
|
|
uvicorn main:app --reload
|
|
```
|
|
|
|
## API Documentation
|
|
|
|
Once the application is running, you can access the API documentation at:
|
|
|
|
- Swagger UI: http://localhost:8000/docs
|
|
- ReDoc: http://localhost:8000/redoc
|
|
|
|
## API Endpoints
|
|
|
|
### Todos
|
|
|
|
- `GET /api/v1/todos/`: Get all todos
|
|
- `POST /api/v1/todos/`: Create a new todo
|
|
- `GET /api/v1/todos/{id}`: Get a specific todo
|
|
- `PUT /api/v1/todos/{id}`: Update a todo
|
|
- `DELETE /api/v1/todos/{id}`: Delete a todo
|
|
|
|
### Health
|
|
|
|
- `GET /api/v1/health/`: Check API health status |