woshiyigefeicfeicnulideshuaigenixinbu

2.1.3 • Public • Published

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

  1. Clone the repository: git clone https://github.com/008luckman/shuiaiwodexin-eight.git
  2. Navigate to the project directory: cd shuiaiwodexin-eight
  3. Install dependencies: npm install
  4. 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.

Package Sidebar

Install

npm i woshiyigefeicfeicnulideshuaigenixinbu

Weekly Downloads

1

Version

2.1.3

License

GPL-3.0

Unpacked Size

4.48 kB

Total Files

3

Last publish

Collaborators

  • reshergirl