The Task Management System API is a RESTful API built using Node.js with Express. It allows users to create, read, update, and delete tasks. The API uses token-based authentication and authorization for secure access to endpoints.
Before setting up the API, make sure you have the following installed on your system:
- Node.js (https://nodejs.org/)
- MongoDB (https://www.mongodb.com/try/download/community)
- Clone the repository or download the source code:
git clone https://github.com/your-username/task-management-api.git
- Change directory to the project folder:
cd task-management-api
- Install the dependencies:
npm install
- Start your MongoDB server. If you're using the default configuration, simply run:
mongod
- Start the API server:
npm start
- The API will start running at http://localhost:3000.
You can access the API documentation using Swagger UI. Open your web browser and visit:
http://localhost:3000/api-docs
To run the unit tests, use the following command:
npm test
The API provides the following endpoints:
-
POST /users/register: User registration (Create a new user).
-
POST /users/login: User login (Get JWT token).
-
POST /tasks: Create a new task (Authentication required).
-
GET /tasks: Retrieve all tasks (Authentication required).
-
GET /tasks/:id: Retrieve a specific task by ID (Authentication required).
-
PATCH /tasks/:id: Update a task (Authentication required).
-
DELETE /tasks/:id: Delete a task (Authentication required).