Skip to content

larissadantier/server-tasks

Repository files navigation

Tech Stack   |    Task Manager API   |    License

📝 Task Manager API

A simple RESTful API for managing tasks (CRUD + bulk import via CSV).

💾 Tech Stack

📌 Features

  • Create a task
  • List all tasks (with optional search)
  • Update a task by id
  • Delete a task by id
  • Mark/unmark a task as completed
  • Import tasks in bulk using a CSV file

📦 Task Structure

Each task has the following properties:

Field Type Description
id string Unique identifier for the task
title string Task title
description string Detailed task description
completed_at datetime/null Timestamp when the task was completed (initially null)
created_at datetime Timestamp when the task was created
updated_at datetime Timestamp when the task was last updated

🚀 API Endpoints

POST /tasks

Create a new task.

Request Body:

{
  "title": "Task Title",
  "description": "Task Description"
}

Behavior:

  • id, created_at, and updated_at are auto-generated.
  • completed_at is initially set to null.

GET /tasks

List all tasks. Supports optional filtering by title and/or description.

Query Params (optional):

?title=example&description=details

PUT /tasks/:id

Update a task's title and/or description.

Request Body:

{
  "title": "Updated Title",
  "description": "Updated Description"
}

Rules:

  • You can update either title, description, or both.
  • updated_at is updated on change.
  • Must validate the task exists before updating.

DELETE /tasks/:id

Delete a task by id.

Rules:

  • Validate task existence before deletion.

PATCH /tasks/:id/complete

Toggle a task’s completion status.

Behavior:

  • If completed_at is null, set it to the current timestamp.
  • If completed_at has a value, reset it to null.

GET /tasks/export-csv

Bulk import tasks from a CSV file.

CSV Format:

id,title,description
1,Task 1,Description for Task 1
2,Task 2,Description for Task 2
...

Behavior:

  • All imported tasks follow the same creation rules as POST /tasks.

🛠️ Setup & Run

# Clone the repository

git clone https://github.com/larissadantier/server-tasks.git

# Install all packages

- Npm
npm install

- Yarn
yarn install

- Pnpm
pnpm install

After all this, you're ready to run the project, just enter the command:

- Docker
pnpm docker:up

- Npm
npm run dev

- Yarn
yarn dev

- Pnpm
pnpm dev

- Bun
bun dev

All done! Now your application will run 😄

🧪 Testing (Optional)

You can use tools like Postman, Insomnia or Yaak to test each route.

📝 License

This project is under the MIT license. See the LICENSE file for more details.

👀 Autor


Developed por Larissa Dantier 🚀

Contact us 👏

        

About

Practice concepts with CRUD of Tasks

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published