Table of Contents
The API is a simple and efficient task management service built with Flask. The platform enables users to manage their tasks seamlessly and reliably. With the API, organizing your tasks becomes effortless, ensuring a smooth experience for individuals.
-
Secure Authentication: The API offers robust user authentication using JWT tokens, ensuring that your task data remains safe and accessible only to you.
-
Task Management: Create, read, update, and delete tasks effortlessly with our user-friendly endpoints. Whether it's a personal to-do list or a project task, managing tasks is quick and hassle-free.
-
Data Persistence: All task data is securely stored in a database, ensuring data integrity and reliability.
-
Input Validation: Strong input validation ensures that the data you enter is accurate and secure, maintaining the integrity of your task management system.
To get a local copy up and running, follow the steps below.
Python3: Get Python
-
Clone this repo
git clone https://github.com/engrmarkk/task_management_system.git
-
Navigate into the directory
cd task_management_system
-
Create a virtual environment
python -m venv your_venv_name
-
Activate the virtual environment on powershell or cmd
your_venv_name\Scripts\activate.bat
On Bash ('Scripts' for windows, 'bin' for linux)
source your_venv_name/Scripts/activate.csh
-
Install project dependencies
pip install -r requirements.txt
-
Create .env file
-
Place your SECRET_KEY, JWT_SECRET_KEY, and DATABASE_URI (for postgresql, then a postgres link) If you want to use use sqlite, you can ignore the DATABASE_URI in the env file (omit it)
DATABASE_URI=<your_postgresql_link> SECRET_KEY=<your_secret_key> JWT_SECRET_KEY=<your_jwt_secret_key>
-
Set your flask app
set FLASK_APP=runserver.py
on linux or macOS
export FLASK_APP=runserver.py
-
Create database (using flask migrate)
flask db init ( This will create a migration file) flask db migrate flask db upgrade (This will create the db along with the tables)
-
Run App
python runserver.py
- Use the link generated on the terminal to access the endpoints
http://127.0.0.1:5000
├── README.md
├── .gitignore
├── app_config
| ├── __init_.py
| ├── Your_sqlite_database
├── endpoints
│ ├── __init__.py
│ ├── auth.py
| | ├──__init__.py
│ └── users.py
| | ├──__init__.py
├── models
| ├── __init_.py
├── app_config
| ├── __init_.py
├── sockets
| ├── __init_.py
├── utils
| ├── __init_.py
├── extensions
| ├── __init_.py
├── your_venv_name
├── .env
├── runserver.py
└── requirements.txt
POST (Register) http://127.0.0.1:8000/api/v1/auth/register
REQUEST
{
"username": "string",
"password": "password"
}
RESPONSE (Success)
{
"message": "User created successfully"
}
RESPONSE (Error)
{
"message": "Username already exist"
}
POST (Login) http://127.0.0.1:8000/api/v1/auth/login
REQUEST
{
"username": "string",
"password": "string"
}
RESPONSE (Success)
{
"access_token": "eyJhbGciOiJIUzIEyM..................."
}
RESPONSE (Error)
{
"message": "User does not exist"
}
To login with your key,
Provide the access token on postman auth (Bearer Token)
`
GET (Get tasks) http://127.0.0.1:8000/api/v1/user/get_tasks
@jwt_required
RESPONSE
{
"tasks": [
{
"completed": true,
"date_created": "19-May-2024 22:20:15",
"id": "0abbf4f4131240dc85888bbc1bd4dc3e",
"task_content": "Write code, Buy foodtuffs, Gym, and Sleep",
"title": "Welcome Task2"
},
{
"completed": false,
"date_created": "19-May-2024 22:18:31",
"id": "66d9c4c3f2bd4b2db2fd9cae4df61161",
"task_content": "This is a welcome task",
"title": "Welcome Task"
}
]
}
GET (Get one Task) http://127.0.0.1:8000/api/v1/user/get_one_task/d8ae7e5dea934f3d9f02c2c3f49f2c72
@jwt_required
RESPONSE
{
"message": "Task found",
"task": {
"completed": false,
"date_created": "19-May-2024 22:21:06",
"id": "d8ae7e5dea934f3d9f02c2c3f49f2c72",
"task_content": "Write code, Buy foodtuffs, Gym, and Sleep",
"title": "Today Todo"
}
}
RESPONSE (Error)
{
"message": "No task found"
}
POST (Create Task) http://127.0.0.1:8000/api/v1/user/create_task
@jwt_required
REQUEST
{
"title": "My List3",
"content": "Write code, Go out"
}
RESPONSE
{
"message": "Task created successfully"
}
PATCH (Update Task) http://127.0.0.1:8000/api/v1/user/update_task/0abbf4f4131240dc85888bbc1bd4dc3e
@jwt_required
REQUEST
{
"content": "Write code, Buy foodtuffs, Gym, and Sleep",
"completed": true
}
RESPONSE (Success)
{
"message": "Task updated successfully"
}
RESPONSE (Error)
{
"message": "No task found"
}
PATCH (Update Task) http://127.0.0.1:8000/api/v1/user/delete_task/d8ae7e5dea934f3d9f02c2c3f49f2c72
@jwt_required
RESPONSE (Success)
{
"message": "Task deleted successfully"
}
RESPONSE (Error)
{
"message": "No task found"
}
Adeniyi Olanrewaju - @iamengrmark - adeniyiboladale@yahoo.com
Project Link: Task Management System API
Live Link (BASE URL): https://task-management-system-cy45.onrender.com/api/v1/
Postman Documentation: Postman DOC