This project is a clean and minimal RESTful API for managing a simple To-Do list, built using Python, Flask, and SQLAlchemy.
π§ Designed for learning and scalability, this API demonstrates essential CRUD operations β perfect for those beginning backend development or looking to understand how Flask integrates with relational databases.
- β Create new tasks
- π Retrieve all tasks or a specific task by ID
- β»οΈ Update task content or completion status
- π Delete tasks
- π Modular architecture using Flask Blueprints
- π§© SQLAlchemy for ORM and MySQL integration
- Python 3
- Flask
- SQLAlchemy
- MySQL (easily adaptable to PostgreSQL or SQLite)
- REST API best practices
API-to-do-list-with-python-and-flask/
βββ app.py # Application entry point
βββ config/ # Database configuration module
β βββ db.py
βββ controllers/ # Contains logic for task operations
β βββ task_controller.py
βββ database/ # Database connection helper
β βββ connection.py
βββ models/ # SQLAlchemy model(s)
β βββ task_model.py
βββ routes/ # Flask Blueprints for API routes
β βββ task_routes.py
βββ README.md # Project overview (this file)
# 1. Clone the repository
git clone https://github.com/josgard94/API-to-do-list-with-python-and-flask.git
# 2. Navigate to the project directory
cd API-to-do-list-with-python-and-flask
# 3. Create a virtual environment & install dependencies
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
# 4. Set up your MySQL database
# Update config/db.py with your credentials
# 5. Run the app
python app.py
Method | Endpoint | Description |
---|---|---|
GET | /tasks |
List all tasks |
GET | /tasks/<id> |
Retrieve a task by ID |
POST | /tasks |
Create a new task |
PUT | /tasks/<id> |
Update an existing task |
DELETE | /tasks/<id> |
Delete a task |