todoapp-zj3gfs/README.md
Automated Action ae91c493c6 Add FastAPI todo application with SQLite database
- Implement CRUD operations for todos
- Add FastAPI with CORS middleware
- Set up SQLite database with Alembic migrations
- Include health endpoint and API documentation
- Configure Ruff for code linting
- Update README with comprehensive documentation
2025-06-17 07:03:02 +00:00

73 lines
1.8 KiB
Markdown

# Todo API
A simple todo application built with FastAPI and SQLite.
## Features
- Create, read, update, and delete todos
- SQLite database with Alembic migrations
- FastAPI with automatic API documentation
- Health check endpoint
- CORS enabled for all origins
## Installation
1. Install dependencies:
```bash
pip install -r requirements.txt
```
2. Run database migrations:
```bash
alembic upgrade head
```
3. Start the application:
```bash
uvicorn main:app --host 0.0.0.0 --port 8000
```
## API Endpoints
- `GET /` - Root endpoint with API information
- `GET /health` - Health check endpoint
- `GET /docs` - Interactive API documentation
- `GET /redoc` - Alternative API documentation
- `GET /openapi.json` - OpenAPI specification
### Todo Endpoints
- `POST /todos/` - Create a new todo
- `GET /todos/` - Get all todos (with pagination)
- `GET /todos/{todo_id}` - Get a specific todo
- `PUT /todos/{todo_id}` - Update a todo
- `DELETE /todos/{todo_id}` - Delete a todo
## Data Model
Todo items have the following fields:
- `id`: Unique identifier (auto-generated)
- `title`: Todo title (required)
- `description`: Optional description
- `completed`: Boolean completion status (default: false)
- `created_at`: Creation timestamp
- `updated_at`: Last update timestamp
## Environment Variables
No environment variables are required for basic operation. The SQLite database is stored at `/app/storage/db/db.sqlite`.
## Development
To run with auto-reload during development:
```bash
uvicorn main:app --reload --host 0.0.0.0 --port 8000
```
## API Documentation
Once the server is running, you can access:
- Interactive documentation: http://localhost:8000/docs
- Alternative documentation: http://localhost:8000/redoc
- OpenAPI specification: http://localhost:8000/openapi.json