
- Add main.py with basic CRUD operations for todo items - Create requirements.txt with necessary dependencies - Update README.md with application details - Include /health endpoint for health checks - Use SQLite for data storage
68 lines
1.5 KiB
Markdown
68 lines
1.5 KiB
Markdown
# Simple Todo App
|
|
|
|
This is a simple Todo application built with FastAPI and SQLite. It provides basic CRUD operations for managing todo items through a RESTful API.
|
|
|
|
## Features
|
|
|
|
- Create, Read, Update, and Delete todo items
|
|
- Health check endpoint
|
|
- SQLite database storage
|
|
- RESTful API with JSON payloads
|
|
- Automatic API documentation
|
|
|
|
## Installation
|
|
|
|
1. Clone the repository
|
|
2. Install dependencies:
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
## Running the Application
|
|
|
|
Start the application with uvicorn:
|
|
|
|
```bash
|
|
uvicorn main:app --reload
|
|
```
|
|
|
|
The application will be available at http://localhost:8000
|
|
|
|
## API Documentation
|
|
|
|
Once the application is running, you can access the auto-generated documentation:
|
|
|
|
- Swagger UI: http://localhost:8000/docs
|
|
- ReDoc: http://localhost:8000/redoc
|
|
|
|
## API Endpoints
|
|
|
|
| Method | Endpoint | Description |
|
|
|--------|----------|-------------|
|
|
| GET | /health | Health check endpoint |
|
|
| GET | /todos/ | Get all todos |
|
|
| GET | /todos/{todo_id} | Get a specific todo by ID |
|
|
| POST | /todos/ | Create a new todo |
|
|
| PUT | /todos/{todo_id} | Update an existing todo |
|
|
| DELETE | /todos/{todo_id} | Delete a todo |
|
|
|
|
## Example Usage
|
|
|
|
### Creating a Todo
|
|
|
|
```bash
|
|
curl -X 'POST' \
|
|
'http://localhost:8000/todos/' \
|
|
-H 'Content-Type: application/json' \
|
|
-d '{
|
|
"title": "Buy groceries",
|
|
"description": "Need to buy milk, eggs, and bread",
|
|
"completed": false
|
|
}'
|
|
```
|
|
|
|
### Getting All Todos
|
|
|
|
```bash
|
|
curl -X 'GET' 'http://localhost:8000/todos/'
|
|
``` |