The Task Management System is a backend API built using Node.js and Express.js. It provides task management functionality with secure user authentication and role-based access control. The API uses MongoDB to store data and follows best practices for code quality
The Task Management System is a backend API built using Node.js and Express.js. It provides task management functionality with secure user authentication and role-based access control. The API uses MongoDB to store data and follows best practices for code quality, including dependency injection and proper design patterns.
Clone the Repository:
git clone https://github.com/Anshuldhakate/task-management-system.git
cd task-management-system
Install Dependencies:
Set Up Environment Variables:
Start the Server:
URL: /api/auth/register
Method: POST
Headers: Content-Type: application/json
Body: json
{
"name": "John Doe",
"email": "[email protected]",
"password": "password123"
}
Response: json
{
"token": "your_jwt_token_here"
}
Login User
URL: /api/auth/login
Method: POST
Headers: Content-Type: application/json
Body: json
{ "email": "[email protected]", "password": "password123" }
Response: json
{
"token": "your_jwt_token_here"
}
- Get All Tasks
- URL: /api/tasks
- Method: GET
- Headers:
- Authorization: Bearer your_jwt_token_here
URL: /api/tasks
Method: POST
Headers:
Content-Type: application/json
Authorization: Bearer your_jwt_token_here
Body: json
{
"title": "New Task",
"description": "Task description",
"priority": "High",
"status": "Pending",
"assignedTo": "userId"
}
URL: /api/tasks/:taskId
Method: PUT
Headers:
ontent-Type: application/json
Authorization: Bearer your_jwt_token_here
Body: json
{
"title": "Updated Task",
"description": "Updated task description",
"priority": "Low",
"status": "Completed",
"assignedTo": "userId"
}
Make a POST request to /api/auth/register with the required fields in the body.
Login with the Registered User:
Make a POST request to /api/auth/login with the user's email and password.
Copy the Token from the Login Response:
Use this token to authenticate requests to protected routes.
Set Authorization Header in Postman:
Go to the Headers tab in Postman.
Add a new header:
Key: Authorization
Value: Bearer your_jwt_token_here