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.
- 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
- 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.
Response Body:
[
{ "id": 1, "name": "Task 1", "completed": false },
{ "id": 2, "name": "Task 2", "completed": true },
{ "id": 3, "name": "Task 3", "completed": false }
]
Response Body:
{ "id": 1, "name": "Task 1", "completed": false }
Request Body:
{ "name": "New Task", "completed": false }
Response Body:
{ "id": 4, "name": "New Task", "completed": false }
Request Body:
{ "completed": true }
Response Body:
{ "id": 1, "name": "Task 1", "completed": true }
Response Status:
204 No Content
To run tests, use the command: npm test
This project is licensed under the MIT License. See the LICENSE file for details.