TaskManager is a task management system built with Node.js and Express, designed to help developers quickly set up a task management API server.
- User registration
- User login
- Create, read, update, and delete tasks
-
Clone the project:
git clone https://github.com/fozzmarc/TaskManager.git cd TaskManager
-
Install dependencies:
npm install
-
Configure environment variables: Create a
.env
file in the project root directory and add the following content:PORT=3000 DB_NAME=taskmanager DB_USER=root DB_PASS=your_password DB_HOST=localhost JWT_SECRET=your_jwt_secret
-
Run the server:
npm start
- URL:
/api/users/register
- Method:
POST
- Request Body:
{ "username": "your_username", "password": "your_password" }
- Response:
{ "message": "User created successfully" }
- URL:
/api/users/login
- Method:
POST
- Request Body:
{ "username": "your_username", "password": "your_password" }
- Response:
{ "token": "your_jwt_token" }
- URL:
/api/users/me
- Method:
GET
- Header:
{ "Authorization": "Bearer your_jwt_token" }
- Response:
{ "id": "user_id", "username": "your_username", "createdAt": "timestamp", "updatedAt": "timestamp" }
- URL:
/api/tasks
- Method:
POST
- Header:
{ "Authorization": "Bearer your_jwt_token" }
- Request Body:
{ "title": "task_title", "description": "task_description" }
- Response:
{ "id": "task_id", "title": "task_title", "description": "task_description", "status": "pending", "userId": "user_id", "createdAt": "timestamp", "updatedAt": "timestamp" }
- URL:
/api/tasks
- Method:
GET
- Header:
{ "Authorization": "Bearer your_jwt_token" }
- Response:
[ { "id": "task_id", "title": "task_title", "description": "task_description", "status": "pending", "userId": "user_id", "createdAt": "timestamp", "updatedAt": "timestamp" }, ... ]
- URL:
/api/tasks/:id
- Method:
PUT
- Header:
{ "Authorization": "Bearer your_jwt_token" }
- Request Body:
{ "title": "updated_title", "description": "updated_description", "status": "updated_status" }
- Response:
{ "id": "task_id", "title": "updated_title", "description": "updated_description", "status": "updated_status", "userId": "user_id", "createdAt": "timestamp", "updatedAt": "timestamp" }
- URL:
/api/tasks/:id
- Method:
DELETE
- Header:
{ "Authorization": "Bearer your_jwt_token" }
- Response:
{}
Contributions of any kind are welcome! Please fork this repository and submit a pull request.
MIT