This is a task manager API created using Node.js, Express.js, and MongoDB.
To get started with the application, you will need to have Node.js and MongoDB installed on your system.
- First, clone the repository and navigate to the project directory.
- Then, install the necessary dependencies using npm:
- You will also need to create a
.env
file in the project root directory and set the following environment variables: - Start the server by running:
git clone https://github.com/MuslimShah/taskManagerAPI.git
cd taskManagerAPI
npm install
PORT=3000
MONGODB_URL=mongodb://localhost:27017/task-manager-api
JWT_SECRET=your_jwt_secret_key
Make sure to replace your_jwt_secret_key
with your own secret key.
npm start
The following API routes are available:
GET /api/v1/tasks
- Returns a list of all tasks.POST /api/v1/tasks
- Creates a new task.GET /api/v1/tasks/:id
- Returns a single task with the specified ID.PATCH /api/v1/tasks/:id
- Updates a task with the specified ID.DELETE /api/v1/tasks/:id
- Deletes a task with the specified ID.
Here are some example requests:
POST /api/v1/tasks
Request body:
{
"title": "Task title",
"description": "Task description"
}
PATCH /api/v1/tasks/:id
Request body:
{
"title": "New task title"
}
That's it! You now have a fully-functional task manager API built with Express.js. If you have any questions or issues, feel free to open an issue or pull request in the repository.