{"id":25534598,"url":"https://github.com/aksweb/algo8_task_management","last_synced_at":"2025-10-10T12:38:06.979Z","repository":{"id":232864427,"uuid":"784676561","full_name":"aksweb/algo8_Task_Management","owner":"aksweb","description":"A2: Task Management system with Node.js , MySQL and Jest Testing","archived":false,"fork":false,"pushed_at":"2024-04-11T18:29:28.000Z","size":1413,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-10T12:38:04.892Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://algo8-task-management.onrender.com/tasks","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aksweb.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-04-10T10:28:39.000Z","updated_at":"2024-04-12T04:06:05.000Z","dependencies_parsed_at":"2024-04-18T20:02:29.137Z","dependency_job_id":null,"html_url":"https://github.com/aksweb/algo8_Task_Management","commit_stats":null,"previous_names":["aksweb/algo8_task_management"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aksweb/algo8_Task_Management","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aksweb%2Falgo8_Task_Management","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aksweb%2Falgo8_Task_Management/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aksweb%2Falgo8_Task_Management/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aksweb%2Falgo8_Task_Management/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aksweb","download_url":"https://codeload.github.com/aksweb/algo8_Task_Management/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aksweb%2Falgo8_Task_Management/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279003896,"owners_count":26083641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-20T03:20:05.844Z","updated_at":"2025-10-10T12:38:06.957Z","avatar_url":"https://github.com/aksweb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **Algo8 Task Management API Docs**\n## This readme is divided into 3 sections\n   **A. Summary.** \u003cbr\u003e\n   **B. Steps \u0026 Requirements to run Hosted API.** \u003cbr\u003e\n   **C. Steps \u0026 Requirements to run Localhost API.** \u003cbr\u003e\n   \n## A. Summary\n\n1. User creates the account by registering.\u003cbr\u003e\n2. User Logs In and generates a JWT authentication token containing the userId. \u003cbr\u003e\n3. Various CRUD operations like \u003cbr\u003e\n     a. Creating a Task. \u003cbr\u003e\n     b. Fetching user's task list.\u003cbr\u003e\n     c. Updating user's task.\u003cbr\u003e\n     d. Deleting user's task.\u003cbr\u003e\n     e. Deleting user and its related task.\u003cbr\u003e\n4.**Hosting Server: Render ([Base Api: algo8-task-management.onrender.com](algo8-task-management.onrender.com))** \u003cbr\u003e\n5.**Hosted MySQL Database : Clever-Cloud**\u003cbr\u003e\n\n## _**B. Requirements for running the hosted API**_:\n\n**1. Install POSTMAN or other REST API Testing tool**\u003cbr\u003e\n**2. Internet Connection.**\n\n## **APIs and how to access them:**\n\n1. User Registration.\n   1. Do a POST request with the following JSON in the body.\n\n```bash\nPOST https://algo8-task-management.onrender.com/signup\nContent-Type: application/json\n\n{\n    \"email\": \"sonipuja@gmail.com\",\n    \"username\": \"sonipuja\",\n    \"password\": \"sonipuja123@\"\n}\n```\n\n![Untitled](pics/fd6b4b7e-735b-49ca-aecc-091561bb9082.png) \u003cbr\u003e\n\n2. User Login.\n   1. Do a POST request with the a similar type of JSON\n   2. After this you will receive a token.\n   3. Copy this token. This will be required for doing the CRUD operations.\n\n```bash\nPOST https://algo8-task-management.onrender.com/login\nContent-Type: application/json\n\n{\n    \"email\": \"soni@gmail.com\",\n    \"password\": \"soni\"\n}\n```\n\nCopy the generated token after login (you can find it in the response body).\n\n![Untitled](pics/Untitled.png)\n\n```bash\ntoken= \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjQsImVtYWlsIjoic29uaXB1amFAZ21haWwuY29tIiwiaWF0IjoxNzEyODM1Mjg4LCJleHAiOjE3MTI4Mzg4ODh9.Jj8X5Hx5ynjgXYtGNnSr1LjyYFZjtdPjrazKq7x8LHM\"\n```\n\n\u003cbr\u003e\nCRUD APIs:\n\n1. Create Task:API\n\n   1. Add Bearer Token as Authorization using the generated token.\n\n      ![Untitled](pics/8a2009da-b9ba-46da-a090-7b37ce00f025.png)\n\n   2. Add the task as raw JSON in the body.\n\n      ![Untitled](pics/d99d8bf4-f827-4996-a819-111435bdd8e8.png)\n\n   3. Do the POST request.\n\n   ```bash\n   POST https://algo8-task-management.onrender.com/tasks\n   Content-Type: application/json\n   Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjQsImVtYWlsIjoic29uaXB1amFAZ21haWwuY29tIiwiaWF0IjoxNzEyODM1Mjg4LCJleHAiOjE3MTI4Mzg4ODh9.Jj8X5Hx5ynjgXYtGNnSr1LjyYFZjtdPjrazKq7x8LHM\n   ```\n\nd. Observe the response:\n\n![Untitled](pics/Untitled%201.png)\n\u003cbr\u003e 2. Read Tasks API.\n\n1.  Add Bearer Token as Authorization using the generated token.\n\n    ![Untitled](pics/Untitled%202.png)\n\n2.  Do the GET request.\n\n```bash\nGET https://algo8-task-management.onrender.com/tasks\n\nAuthorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjQsImVtYWlsIjoic29uaXB1amFAZ21haWwuY29tIiwiaWF0IjoxNzEyODM1Mjg4LCJleHAiOjE3MTI4Mzg4ODh9.Jj8X5Hx5ynjgXYtGNnSr1LjyYFZjtdPjrazKq7x8LHM\n```\n\nc. Observe the response in body.\n\n![Untitled](pics/Untitled%203.png)\n\u003cbr\u003e\n\n3. Update Task API:\n\n   1. Add Bearer Token as Authorization using the generated token.\n\n      ![Untitled](pics/Untitled%204.png)\n\n   2. Add the updated task as raw JSON in the body.\n\n      ![Untitled](pics/Untitled%205.png)\n\n   3. Do the PUT request with the corresponding task ID.\n\n   ```bash\n   PUT https://algo8-task-management.onrender.com/tasks/3\n   Content-Type: application/json\n   Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjQsImVtYWlsIjoic29uaXB1amFAZ21haWwuY29tIiwiaWF0IjoxNzEyODM1Mjg4LCJleHAiOjE3MTI4Mzg4ODh9.Jj8X5Hx5ynjgXYtGNnSr1LjyYFZjtdPjrazKq7x8LHM\n   ```\n\n   \u003cbr\u003e\n\n4. DELETE Task API:\n\n   1. Add Bearer Token as Authorization using the generated token.\n\n      ![Untitled](pics/Untitled%206.png)\n\n   2. Do the DELETE request with the corresponding task ID.\n\n   ```bash\n   DELETE https://algo8-task-management.onrender.com/tasks/2\n   Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjQsImVtYWlsIjoic29uaXB1amFAZ21haWwuY29tIiwiaWF0IjoxNzEyODM1Mjg4LCJleHAiOjE3MTI4Mzg4ODh9.Jj8X5Hx5ynjgXYtGNnSr1LjyYFZjtdPjrazKq7x8LHM\n   ```\n\n   c. Observe the response.\n\n   ![Untitled](pics/Untitled%207.png)\n   \u003cbr\u003e\n\n5. DELETE USER API:\n\n   1. Add Bearer Token as Authorization using the generated token.\n\n      ![Untitled](pics/Untitled%208.png)\n\n   b.Do the DELETE request.\n   \u003cbr\u003e\n\n   ```bash\n   DELETE https://algo8-task-management.onrender.com/deluser\n   Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjQsImVtYWlsIjoic29uaXB1amFAZ21haWwuY29tIiwiaWF0IjoxNzEyODM1Mjg4LCJleHAiOjE3MTI4Mzg4ODh9.Jj8X5Hx5ynjgXYtGNnSr1LjyYFZjtdPjrazKq7x8LHM\n   ```\n\u003cbr\u003e \u003cbr\u003e\n## _**C. Requirements for running the API on localhost**_:\n\n**1. Clone this repository.** \u003cbr\u003e\n```bash\n   git clone https://github.com/aksweb/algo8_Task_Management.git\n```\n**2. Install MySQL and Node.js.**\n**3. Create a .env file containing the following variables as per your MySQL connection.** \u003cbr\u003e\n```bash\nDB_HOST\nDB_USERNAME\nDB_PASSWORD\nDB_NAME\n```\n**4. Run the following SQL commands** \u003cbr\u003e\n```bash\n-- Database\nCREATE DATABASE IF NOT EXISTS task_management_db;\n\n-- Switch to db\nUSE task_management_db;\n\n-- Create the users table\n\nCREATE TABLE IF NOT EXISTS users (\n    id INT AUTO_INCREMENT PRIMARY KEY, email VARCHAR(100) NOT NULL UNIQUE, username VARCHAR(50) NOT NULL UNIQUE, password VARCHAR(255) NOT NULL\n);\n\n-- Create the tasks table\nCREATE TABLE IF NOT EXISTS tasks (\n    id INT AUTO_INCREMENT PRIMARY KEY, title VARCHAR(100) NOT NULL, description TEXT, user_id INT, FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE\n);\n```\n\n**4. Open the project directory in terminal and run the following commands**\n\n```bash\nnpm install\nnpm start\n```\n\n**6. Or To directly Test the APIs run the following command before stopping the server on port 3000:**\n\n   ```bash\n   npm run test\n   ```\n\n**7. To manually test the API using REST api extension or POSTMAN as explained above, do the following:**\n\n   ```bash\n   ### signup\n   POST http://localhost:3000/signup\n\n   Content-Type: application/json\n   {\n    \"email\": \"example@gmail.com\",\n    \"username\": \"exm\",\n    \"password\": \"exm\"\n   }\n   ### login\n   POST http://localhost:3000/login\n   Content-Type: application/json\n\n   {\n    \"email\": \"example@gmail.com\",\n    \"password\": \"exm\"\n   }\n   ### get tasks of user\n   GET http://localhost:3000/tasks\n   Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjU4LCJlbWFpbCI6InNvbmFsaUBnbWFpbC5jb20iLCJpYXQiOjE3MTI4MjQ2MDUsImV4cCI6MTcxMjgyODIwNX0.vxiYTsgjb7flM7q_bnGezrrq6puIZRq-sdV50-fqB_E\n\n   ### creating tasks\n   POST http://localhost:3000/tasks\n   Content-Type: application/json\n   Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjU4LCJlbWFpbCI6InNvbmFsaUBnbWFpbC5jb20iLCJpYXQiOjE3MTI4MjQ2MDUsImV4cCI6MTcxMjgyODIwNX0.vxiYTsgjb7flM7q_bnGezrrq6puIZRq-sdV50-fqB_E\n   {\n    \"title\": \"mujhe gud paratha chaheye\",\n    \"description\": \"I m on diet\"\n   }\n   ###update\n   PUT http://localhost:3000/tasks/41\n   Content-Type: application/json\n   Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjU4LCJlbWFpbCI6InNvbmFsaUBnbWFpbC5jb20iLCJpYXQiOjE3MTI4MjQ2MDUsImV4cCI6MTcxMjgyODIwNX0.vxiYTsgjb7flM7q_bnGezrrq6puIZRq-sdV50-fqB_E\n   {\n   \"title\": \"testing\",\n   \"description\": \"I m on dietI m on diet\"\n   }\n\n   ### delete\n   DELETE http://localhost:3000/tasks/7\n   Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjExLCJlbWFpbCI6InlhZGF2QGdtYWlsLmNvbSIsImlhdCI6MTcxMjc5NjkzNCwiZXhwIjoxNzEyODAwNTM0fQ.-7QHtq6E0u5KOsCsb-ghGeX0YmcVU63HWpYdoV9dZsA\n\n   ### delete user and data\n   DELETE http://localhost:3000/deluser\n   Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjExLCJlbWFpbCI6InlhZGF2QGdtYWlsLmNvbSIsImlhdCI6MTcxMjc5NjkzNCwiZXhwIjoxNzEyODAwNTM0fQ.-7QHtq6E0u5KOsCsb-ghGeX0YmcVU63HWpYdoV9dZsA\n   ```\n\n**Test Cases:**\n1. Test case for the signup route \u003cbr\u003e\n2. Test case for the login route. \u003cbr\u003e\n3. Test case for the invalid login attempt. \u003cbr\u003e\n4. Test case for fetching tasks. \u003cbr\u003e\n5. Test case for unauthorized fetching. \u003cbr\u003e\n6. Test case for creating a task. \u003cbr\u003e\n7. Test case for updating a task. \u003cbr\u003e\n8. Test case for deleting all tasks of the authenticated user. \u003cbr\u003e\n   ![TestCases](pics/tests.png) \u003cbr\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faksweb%2Falgo8_task_management","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faksweb%2Falgo8_task_management","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faksweb%2Falgo8_task_management/lists"}