This project offers APIs to manage tasks through MongoDB. Below are instructions on how to work with these APIs.
- In the
db
folder, locate themongoClient/createMongoClient.js
file. - Update the MongoDB URI based on your environment:
- For Atlas (Cloud): Set the
mongodbCloudUri
variable. - For Compass (Local): Set the
mongodbLocalUri
variable.
- For Atlas (Cloud): Set the
- In the
src/routes/index.js
file, the routes are defined for task management. - This file connects to MongoDB, creates necessary collections, and initializes three APIs:
GET /tasks
: Retrieve all tasks.POST /createTask
: Create a new task.PUT /updateTask/:id
: Update an existing task.
- To create a new task, use the
POST /createTask
API. - Send a POST request to this endpoint with the task details in the request body.
- To update an existing task, use the
PUT /updateTask/:id
API. - Send a PUT request to this endpoint with the task ID as a parameter (
:id
) and the updated task details in the request body.
- The
GET /tasks
API retrieves all tasks. - Send a GET request to this endpoint to fetch the list of tasks.