A robust REST API for managing tasks, groups, and user assignments built with Node.js, Express, and MongoDB.
- Node.js
- MongoDB
- npm or yarn
- Clone the repository
git clone [repository-url]
- Install dependencies
npm install
- Create a
.env
file with the following variables:
PORT=3000
MONGODB_URI=your_mongodb_connection_string
ACCESS_TOKEN_SECRET=your_jwt_secret
REFRESH_TOKEN_SECRET=your_refresh_token
SMTP_HOST=your_smtp_host
SMTP_PORT=your_smtp_port
SMTP_USER=your_smtp_username
SMTP_PASS=your_smtp_password
MAIL_FROM_NAME=your_app_name
MAIL_FROM_ADDRESS=your_email_address
- Start the server
npm start
POST /api/v1/user/register
Content-Type: application/json
{
"firstName": "John",
"lastName": "Doe",
"userName": "johndoe",
"email": "user@example.com",
"phoneNumber": "+2345678900",
"password": "password123"
}
POST /api/v1/user/login
Content-Type: application/json
{
"email": "user@example.com",
"password": "password123"
}
POST /api/v1/user/verify
Content-Type: application/json
{
"email": "user@example.com",
"otp": "12345"
}
GET /api/v1/user/getUser
Authorization: Bearer your_jwt_token
POST /api/v1/user/forgotPassword
Content-Type: application/json
{
"email": "user@example.com"
}
POST /api/v1/user/resetPassword
Content-Type: application/json
{
"token": "reset_token",
"newPassword": "newPassword123"
}
POST /api/v1/user/resend-otp
Content-Type: application/json
{
"email": "user@example.com"
}
POST /api/v1/group/register
Authorization: Bearer your_jwt_token
Content-Type: application/json
{
"groupName": "Marketing Team",
"description": "Group for marketing team members"
}
PUT /api/v1/group/:groupId
Authorization: Bearer your_jwt_token
Content-Type: application/json
{
"groupName": "Updated Group Name",
"description": "Updated group description"
}
POST /api/v1/admin/role/:groupId
Authorization: Bearer your_jwt_token
Content-Type: application/json
{
"memberId": "user_id",
"role": "admin" // Options: "admin", "manager", "member"
}
POST /api/v1/admin/add/:groupId
Authorization: Bearer your_jwt_token
Content-Type: application/json
{
"newMemberId": "user_id",
"role": "member" // Options: "admin", "manager", "member"
}
PUT /api/v1/add/remove/:groupId
Authorization: Bearer your_jwt_token
{
"memberId": "user_id",
}
POST /api/v1/task/create/:groupId
Authorization: Bearer your_jwt_token
Content-Type: application/json
{
"title": "Task Title",
"description": "Task Description",
"priority": "high", // Options: "high", "low", "urgent"
"status": "pending", // Options: "pending", "in-progress", "completed", "on-hold"
"tasksList": ["task1", "task2"],
"dueDate": "2024-03-20",
"assignedTo": ["user_id1", "user_id2"],
"supervisor": "supervisor_id"
}
PUT /api/v1/task/update/:taskId
Authorization: Bearer your_jwt_token
Content-Type: application/json
{
"title": "Updated Title",
"status": "in-progress",
"priority": "urgent"
}
All endpoints may return the following error responses:
{
"status": "error",
"message": "Error description"
}