
- Add /api/todos/search endpoint with text search capability - Implement filtering by completed status - Include pagination and result count - Update documentation with new endpoint details generated with BackendIM... (backend.im)
64 lines
1.4 KiB
Markdown
64 lines
1.4 KiB
Markdown
# Simple Todo App
|
|
|
|
This is a FastAPI application that implements a simple Todo API.
|
|
|
|
## Features
|
|
|
|
- Create, read, update, and delete todo items
|
|
- Search todos by text query with optional filtering
|
|
- Health check endpoint
|
|
- SQLite database for data storage
|
|
- FastAPI automatic documentation
|
|
|
|
## Getting Started
|
|
|
|
### Prerequisites
|
|
|
|
- Python 3.7+
|
|
- Pip package manager
|
|
|
|
### Installation
|
|
|
|
1. Clone the repository
|
|
2. Install dependencies:
|
|
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
### Running the Application
|
|
|
|
```bash
|
|
uvicorn main:app --reload
|
|
```
|
|
|
|
The server will start at http://localhost:8000
|
|
|
|
### API Documentation
|
|
|
|
- Swagger UI: http://localhost:8000/docs
|
|
- ReDoc: http://localhost:8000/redoc
|
|
|
|
## API Endpoints
|
|
|
|
- `GET /api/todos`: List all todos
|
|
- `GET /api/todos/search`: Search todos by text query
|
|
- `POST /api/todos`: Create a new todo
|
|
- `GET /api/todos/{todo_id}`: Get a specific todo
|
|
- `PUT /api/todos/{todo_id}`: Update a todo
|
|
- `DELETE /api/todos/{todo_id}`: Delete a todo
|
|
- `GET /health`: Check application health
|
|
|
|
### Search Endpoint
|
|
|
|
The search endpoint allows searching todos by text query with additional filters:
|
|
|
|
```
|
|
GET /api/todos/search?q=search_term&completed=true&skip=0&limit=10
|
|
```
|
|
|
|
Parameters:
|
|
- `q`: (required) Search text to match in title or description
|
|
- `completed`: (optional) Filter by completion status (true/false)
|
|
- `skip`: (optional) Number of records to skip for pagination
|
|
- `limit`: (optional) Maximum number of records to return |