Skip to content

Xavi1/task-manager-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Task Manager API

A simple Task Manager API built with Node.js and Express.js to handle task creation, retrieval, updating, and deletion.

Features

  • ✅ Create a new task
  • 📋 Retrieve all tasks
  • ✏️ Update a task (mark as completed)
  • ❌ Delete a task

Installation

  1. Clone the repository:

    git clone https://github.com/Xavi1/task-manager-api
    cd task-manager-api
  2. Install dependencies:

    npm install
  3. Start the server:

    node index.js

    The API will be available at http://localhost:3000

API Endpoints

1️⃣ Get All Tasks

GET /tasks

📌 Response:

[]

2️⃣ Create a Task

POST /tasks

📌 Request Body (JSON):

{
  "title": "Start New Task"
}

📌 Response:

{
  "id": 1, "title": "Start New Task", "completed": false
}

3️⃣ Update a Task

PUT /tasks/:id

📌 Request Body (JSON):

{
  "completed": true
}

📌 Response:

{
  "id": 1, "title": "Start New Task", "completed": true
}

4️⃣ Delete a Task

DELETE /tasks/:id

📌 Response:

{
  "message": "Task deleted successfully"
}

Running API Calls in CMD (Windows)

Get All Tasks

curl -X GET http://localhost:3000/tasks

Create a Task

curl -X POST http://localhost:3000/tasks -H "Content-Type: application/json" -d "{\"title\":\"Start New Task\"}"

Update a Task

curl -X PUT http://localhost:3000/tasks/1 -H "Content-Type: application/json" -d "{\"completed\": true}"

Delete a Task

curl -X DELETE http://localhost:3000/tasks/1

License

This project is licensed under the MIT License.

About

A simple task manager that can run crud operations

Resources

Stars

Watchers

Forks

Packages

No packages published