woshiyigefeicfeicnulideshuaigenixinbu
v2.1.3
Published
the application is fully considered to
Downloads
5
Maintainers
Readme
Task Management API
This repository contains a Node.js application that implements a RESTful API for managing tasks. It provides endpoints for performing CRUD (Create, Read, Update, Delete) operations on tasks stored in memory.
Installation
- Clone the repository:
git clone https://github.com/008luckman/shuiaiwodexin-eight.git
- Navigate to the project directory:
cd shuiaiwodexin-eight
- Install dependencies:
npm install
- Run the server:
node index.js
Endpoints
- GET /tasks: Fetches all tasks.
- GET /tasks/:id: Fetches a specific task by ID.
- POST /tasks: Creates a new task.
- PUT /tasks/:id: Updates the status of a task.
- DELETE /tasks/:id: Deletes a task.
Request and Response Format
GET /tasks
Response Body:
[
{ "id": 1, "name": "Task 1", "completed": false },
{ "id": 2, "name": "Task 2", "completed": true },
{ "id": 3, "name": "Task 3", "completed": false }
]
GET /tasks/:id
Response Body:
{ "id": 1, "name": "Task 1", "completed": false }
POST /tasks
Request Body:
{ "name": "New Task", "completed": false }
Response Body:
{ "id": 4, "name": "New Task", "completed": false }
PUT /tasks/:id
Request Body:
{ "completed": true }
Response Body:
{ "id": 1, "name": "Task 1", "completed": true }
DELETE /tasks/:id
Response Status:
204 No Content
Running Tests
To run tests, use the command: npm test
License
This project is licensed under the MIT License. See the LICENSE file for details.