
- Set up project structure with FastAPI - Create Todo model with SQLAlchemy - Set up Alembic for database migrations - Implement CRUD operations for todos - Add health endpoint - Update README with setup and usage instructions generated with BackendIM... (backend.im)
83 lines
1.8 KiB
Markdown
83 lines
1.8 KiB
Markdown
# Simple Todo Application
|
|
|
|
A RESTful API for managing todo items built with FastAPI and SQLAlchemy.
|
|
|
|
## Features
|
|
|
|
- Create, read, update, and delete todo items
|
|
- Database migrations with Alembic
|
|
- SQLite database
|
|
- Health check endpoint
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
.
|
|
├── alembic.ini
|
|
├── app
|
|
│ ├── api
|
|
│ │ ├── endpoints
|
|
│ │ │ └── todos.py
|
|
│ │ └── routes.py
|
|
│ ├── core
|
|
│ │ └── config.py
|
|
│ ├── crud
|
|
│ │ └── todo.py
|
|
│ ├── db
|
|
│ │ └── session.py
|
|
│ ├── models
|
|
│ │ └── todo.py
|
|
│ └── schemas
|
|
│ └── todo.py
|
|
├── main.py
|
|
├── migrations
|
|
│ ├── env.py
|
|
│ ├── script.py.mako
|
|
│ └── versions
|
|
│ └── 001_create_todos_table.py
|
|
└── requirements.txt
|
|
```
|
|
|
|
## Installation
|
|
|
|
1. Clone the repository:
|
|
```bash
|
|
git clone <repository-url>
|
|
cd simpletodoapplication
|
|
```
|
|
|
|
2. Install dependencies:
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
## Running the Application
|
|
|
|
Start the application using Uvicorn:
|
|
```bash
|
|
uvicorn main:app --reload
|
|
```
|
|
|
|
The API will be available at http://localhost:8000.
|
|
|
|
API documentation is automatically generated and available at:
|
|
- http://localhost:8000/docs (Swagger UI)
|
|
- http://localhost:8000/redoc (ReDoc)
|
|
|
|
## API Endpoints
|
|
|
|
- `GET /health` - Health check endpoint
|
|
- `GET /api/v1/todos` - List all todos
|
|
- `POST /api/v1/todos` - Create a new todo
|
|
- `GET /api/v1/todos/{todo_id}` - Get a specific todo
|
|
- `PUT /api/v1/todos/{todo_id}` - Update a todo
|
|
- `DELETE /api/v1/todos/{todo_id}` - Delete a todo
|
|
|
|
## Database Migrations
|
|
|
|
To apply migrations:
|
|
```bash
|
|
alembic upgrade head
|
|
```
|
|
|
|
This is a FastAPI application bootstrapped by BackendIM, the AI-powered backend generation platform. |