backend Project
This API allows users to manage a collection of tasks with basic CRUD operations. The tasks are stored in memory, and the API supports creating, reading, updating, and deleting tasks.
URL: /tasks
Method: GET
Description: Retrieve a list of all tasks.
URL: /tasks/:id
Method: GET
Description: Retrieve a specific task by its ID.
Parameters:
id
(required): ID of the task to retrieve.
URL: /tasks
Method: POST
Description: Create a new task.
Request Body:
{
"title": "New Task",
"description": "Description for new task"
}
URL: /tasks/:id
Method: PUT
Description: Update an existing task by its ID.
Parameters:
id
(required): ID of the task to update.
Request Body:
{
"title": "Updated Task",
"description": "Updated description for task"
}
URL: /tasks/:id
Method: DELETE
Description: Delete a task by its ID.
Parameters:
id
(required): ID of the task to delete.
-
Install dependencies
npm install express ejs method-override uuid
-
Start the server
node app.js
-
Access the API
Open a web browser and go to
http://localhost:8080/tasks
to view the tasks.
curl -X POST http://localhost:8080/tasks -H "Content-Type: application/json" -d '{"title":"New Task","description":"Description for new task"}'
curl -X PUT http://localhost:8080/tasks/<task-id> -H "Content-Type: application/json" -d '{"title":"Updated Task","description":"Updated description for task"}'