- Node.js and npm installed
- MongoDB Atlas account and cluster setup
- Git installed
- Clone the repository
git clone https://github.com/pankajmokashi/manage-tasks.git
cd manage-tasks
- Navigate to the backend directory
cd task-management-backend
- Install dependencies
npm install
- Create a .env file in the backend directory
touch .env
- Add the following environment variables to the .env file
MONGODB_URI=your_mongodb_atlas_connection_string
- Start the backend server
npm start
- Navigate to the frontend directory
cd ../task-management
- Install dependencies
npm install
- Start the frontend server
npm start
Authentication
-
Login: POST /login
- Request body: { "username": "your_username", "password": "your_password" }
- Response: { "token": "your_jwt_token" }
-
Register: POST /register
- Request body: { "username": "your_username", "password": "your_password" }
- Response: { "message": "User registered successfully" }
Tasks
-
Get all tasks: GET /tasks
- Response: [ { "id": "task_id", "title": "task_title", "description": "task_description" }, ... ]
-
Get task by ID: GET /tasks/:id
- Response: { "id": "task_id", "title": "task_title", "description": "task_description" }
-
Create task: POST /tasks
- Request body: { "title": "task_title", "description": "task_description" }
- Response: { "id": "task_id", "title": "task_title", "description": "task_description" }
-
Update task: PUT /tasks/:id
- Request body: { "title": "task_title", "description": "task_description" }
- Response: { "id": "task_id", "title": "task_title", "description": "task_description" }
-
Delete task: DELETE /tasks/:id
- Response: { "message": "Task deleted successfully" }