- Student: Marinos Matthaiou
- Registration Number: inf2023004
- Course: Software Technology
- Semester: 5th
├── app.py
├── tasks.json
├── test_app.py
├── Dockerfile
├── README.md
└── .github/
└── workflows/
└── ci.yml
This project is a simple Task Management API implemented in Python using the Flask framework.
The application allows creating, retrieving, and deleting tasks, which are stored in a JSON file (tasks.json).
Each task contains the following fields:
idusernametitledescriptiondeadline
Each task's id is unique and auto-incrementing, even if a task is deleted.
| Method | Endpoint | Description |
|---|---|---|
| GET | /tasks | Returns all tasks |
| GET | /tasks/ | Returns the task with the given id |
| POST | /tasks | Creates a new task |
| DELETE | /tasks/ | Deletes the task with the given id |
Tasks are displayed sorted by id.
Unit tests using pytest were used to verify the correct functioning of the application.
- Task creation (POST)
- Retrieving all tasks (GET)
- Retrieving a task by id
- Task deletion (DELETE)
- Task sorting check
- Uniqueness and auto-increment check of
idafter deletion
Tests are implemented in the test_app.py file.
- Install required packages:
pip install flask pytest
- Start the Flask API:
python app.py
- The application runs at:
http://localhost:5000/tasks
- Run the unit tests:
python -m pytest -v test_app.py
A Dockerfile is provided to build and run the application via Docker.
- Build the image:
docker build -t task_api .
- Run the container:
docker run -d -p 5000:5000 task_api
- Check the container ID:
docker ps
- Open the API in your browser:
http://localhost:5000/tasks
- A GitHub Actions workflow (
.github/workflows/ci.yml) has been implemented, which:- Runs automatically on push and pull request
- Installs Python & dependencies
- Runs the unit tests with pytest
Successful test execution can be verified in the Actions tab on GitHub.