This repository contains the Task Management API which provides endpoints to manage tasks including creating, retrieving, and deleting tasks.
The Task Management API provides a simple interface to manage tasks. The API allows you to perform CRUD (Create, Read, Update, Delete) operations on tasks.
To set up the Task Management API locally:
-
Clone the repository:
git clone https://github.com/MrRezoo/TaskManagement.git cd TaskManagement
-
Install the dependencies:
npm install
-
Start the server:
npm start
The API will be available at http://localhost:3000
.
GET /api/health/
Checks the health status of the API.
200 OK
: Health status of the API.
GET /api/tasks/
Retrieves a list of all tasks.
200 OK
: A list of tasks.
POST /api/tasks/
Creates a new task.
title
(string): Title of the task.description
(string): Description of the task.status
(string): Status of the task (pending
,completed
,in_progress
).
201 Created
: Task created successfully.400 Bad Request
: Invalid input.
GET /api/tasks/{id}/
Retrieves a specific task by ID.
id
(string): ID of the task.
200 OK
: Task details.404 Not Found
: Task not found.
DELETE /api/tasks/{id}/
Deletes a specific task by ID.
id
(string): ID of the task.
204 No Content
: Task deleted successfully.
Request
curl -X GET http://localhost:3000/api/health/
Response
{
"message": "",
"success": true
}
Request
curl -X GET http://localhost:3000/api/tasks/
Response
{
"result": [
{
"id": "3ea40a96-045a-45ae-b526-8e7f515d335e",
"title": "One",
"description": "des",
"status": "pending",
"created_at": "2024-07-09T19:08:55.994283+03:30",
"updated_at": "2024-07-09T19:08:55.994283+03:30"
}
],
"success": true,
"code": 200,
"validation_errors": null,
"error": null
}
Request
curl -X POST http://localhost:3000/api/tasks/ \
-H "Content-Type: application/json" \
-d '{
"title": "One",
"description": "des",
"status": "pending"
}'
Response
{
"result": {
"id": "3ea40a96-045a-45ae-b526-8e7f515d335e",
"title": "One",
"description": "des",
"status": "pending",
"created_at": "2024-07-09T19:08:55.994283+03:30",
"updated_at": "2024-07-09T19:08:55.994283+03:30"
},
"success": true,
"code": 201,
"validation_errors": null,
"error": null
}
Request
curl -X GET http://localhost:3000/api/tasks/3ea40a96-045a-45ae-b526-8e7f515d335e/
Response
{
"result": {
"id": "3ea40a96-045a-45ae-b526-8e7f515d335e",
"title": "One",
"description": "des",
"status": "pending",
"created_at": "2024-07-09T19:08:55.994283+03:30",
"updated_at": "2024-07-09T19:08:55.994283+03:30"
},
"success": true,
"code": 200,
"validation_errors": null,
"error": null
}
Request
curl -X DELETE http://localhost:3000/api/tasks/3ea40a96-045a-45ae-b526-8e7f515d335e/
Response
204 No Content
This project is licensed under the MIT License - see the LICENSE file for details.
This README includes detailed explanations for each API endpoint along with examples of how to use them. Adjust the server URL (`http://localhost:3000`) and any other specific details as necessary to match your actual setup.