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
- Clone the repository
- Install dependencies:
pip install -r requirements.txt
Running the Application
Start the application with uvicorn:
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
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
curl -X 'GET' 'http://localhost:8000/todos/'
Description
Languages
Python
100%