- Go to VSCODE terminal or command prompt:
- If using VS Code terminal, activate the base environment using conda activate base.
- Install the required packages and libraries by running the following commands: pip install flask pip install flask-cors pip install pymysql pip install flask-mysql
- Open your browser and go to postman.com.
- Sign in or create a new account.
For MYSQL Database connection, make a 'assignment' named database and a 'task' named table with the structure:
CREATE TABLE task ( id INT(11) NOT NULL AUTO_INCREMENT, title VARCHAR(255) NOT NULL, description TEXT, duedate DATE, status ENUM('Incomplete', 'In Progress', 'Completed'), PRIMARY KEY (id) );
Or can also add in the SQL section put these query:
( ALTER TABLE emp
ADD PRIMARY KEY (id
);
ALTER TABLE emp
MODIFY id
int(11) NOT NULL AUTO_INCREMENT; )
- Open the terminal.
- Navigate to the project directory.
- Run the command python main.py to start the application.
- Inside Postman create a collection and then click on the plus icon
- Select the appropriate HTTP method for each endpoint and enter the corresponding URL:
Select 'POST' method for 'create' and put this URL http://127.0.0.1:5000/create ( In the body section select raw and set the format to "JSON" the put this: { "id": "Task id" "title": "Task Title", "description": "Task Description", "duedate": "2023-06-10", "status": "In Progress" } Note: ( Replace task ID with actual ID )
Select 'GET' method for 'listing tasks by ID' and put this URL http://127.0.0.1:5000/task/1
Select 'GET' method for 'listing all tasks' and put this URL http://127.0.0.1:5000/task
Select 'GET' method for 'update' and put this URL http://127.0.0.1:5000/update ( In the body section select raw and set the format to "JSON" the put this: { "id": "Task id for updating" "title": "Task update", "description": "Task Description update", "duedate": "2023-06-10", "status": "In Progress update" } Note: Replace task ID with actual ID
Select 'DELETE' method for 'delete' and put this URL http://127.0.0.1:5000/delete/2