This project is a simple API for performing CRUD operations on tasks, storing them in a local CSV file. It is built using vanilla Node.js to help learn foundational concepts.
- CRUD Operations: Create, Read, Update, and Delete tasks.
- CSV File Storage: Tasks are stored in and loaded from a local CSV file.
- Vanilla Node.js: Built without any frameworks to understand core Node.js functionalities.
- Streams and Buffers: Handling file operations efficiently.
- Request and Response Data Manipulation: Processing incoming request data and sending appropriate responses.
- Query Parameters and Route Parameters: Extracting and using parameters from URLs to update, delete or load filtered data.
- Request Body Handling: Parsing and using data sent in the body of HTTP requests.
- HTTP Status Codes: Sending appropriate HTTP status codes in responses.
-
Clone the repository:
git clone https://github.com/rafaelrmb/nodejs_chal01.git cd nodejs_chal01
-
Install dependencies:
npm install
-
Start the server:
node server.js
-
POST - /tasks
- Create a new task with
title
anddescription
provided in the request body. - Fields
id
,created_at
,updated_at
, andcompleted_at
are automatically generated.
- Create a new task with
-
GET - /tasks
- List all tasks in the database.
- Supports filtering tasks by
title
anddescription
.
-
PUT - /tasks/:id
- Update a task by
id
. - Accepts
title
and/ordescription
in the request body for updates. - Ensures the
id
exists before updating.
- Update a task by
-
DELETE - /tasks/:id
- Remove a task by
id
. - Ensures the
id
exists before deleting.
- Remove a task by
-
PATCH - /tasks/:id/complete
- Mark a task as complete or revert it to an incomplete state.
- Ensures the
id
exists before updating.
- Ensure Node.js is installed on your machine.
- This project is intended for educational purposes to understand basic Node.js concepts.