https://github.com/josgard94/api-to-do-list-with-python-and-flask
This code serves as an illustrative example of building an API using Python and Flask. It showcases the implementation of an API for managing a To-Do List, demonstrating fundamental CRUD operations such as task creation and updating.
https://github.com/josgard94/api-to-do-list-with-python-and-flask
api api-rest database database-coneccion example-project flask flask-api learning-python mysql pyth python singleton-pattern sqlalchemy sqlalchemy-database sqlalchemy-orm sqlalchemy-python
Last synced: about 1 month ago
JSON representation
This code serves as an illustrative example of building an API using Python and Flask. It showcases the implementation of an API for managing a To-Do List, demonstrating fundamental CRUD operations such as task creation and updating.
- Host: GitHub
- URL: https://github.com/josgard94/api-to-do-list-with-python-and-flask
- Owner: josgard94
- License: cc0-1.0
- Created: 2023-06-17T03:33:50.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-02T07:08:48.000Z (over 2 years ago)
- Last Synced: 2025-01-21T21:34:08.177Z (about 1 year ago)
- Topics: api, api-rest, database, database-coneccion, example-project, flask, flask-api, learning-python, mysql, pyth, python, singleton-pattern, sqlalchemy, sqlalchemy-database, sqlalchemy-orm, sqlalchemy-python
- Language: Python
- Homepage:
- Size: 14.6 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 📝 To-Do List API with Python & Flask
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.
---
## 🚀 Features
- ✅ 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
---
## 🛠 Tech Stack
- **Python 3**
- **Flask**
- **SQLAlchemy**
- **MySQL** (easily adaptable to PostgreSQL or SQLite)
- **REST API best practices**
---
## 📁 Project Structure
```
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)
```
---
## ▶️ Getting Started
```bash
# 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
```
---
## 📬 API Endpoints
| Method | Endpoint | Description |
|--------|----------------|--------------------------|
| GET | `/tasks` | List all tasks |
| GET | `/tasks/` | Retrieve a task by ID |
| POST | `/tasks` | Create a new task |
| PUT | `/tasks/` | Update an existing task |
| DELETE | `/tasks/` | Delete a task |
---
## ⭐ Like it?
Leave a ⭐ if you enjoy it or find it useful!
---