This project implements a backend service for a Todo application. The service provides APIs for managing and retrieving todo items, with various filtering options. The backend is built using Node.js, Express, and SQLite.
Column | Type |
---|---|
id | INTEGER |
todo | TEXT |
category | TEXT |
priority | TEXT |
status | TEXT |
due_date | DATE |
- Replace spaces in URL with
%20
. - Possible values for
priority
areHIGH
,MEDIUM
, andLOW
. - Possible values for
status
areTO DO
,IN PROGRESS
, andDONE
. - Possible values for
category
areWORK
,HOME
, andLEARNING
. - Use the format
yyyy-MM-dd
for formatting dates with the date-fnsformat
function.
- Invalid Status
- Response
- Status code: 400
- Body:
Invalid Todo Status
- Response
- Invalid Priority
- Response
- Status code: 400
- Body:
Invalid Todo Priority
- Response
- Invalid Category
- Response
- Status code: 400
- Body:
Invalid Todo Category
- Response
- Invalid Due Date
- Response
- Status code: 400
- Body:
Invalid Due Date
- Response
-
Scenario 1
- Sample API:
/todos/?status=TO%20DO
- Description: Returns a list of all todos whose status is 'TO DO'
- Response:
[ { "id": 2, "todo": "Buy a Car", "priority": "MEDIUM", "status": "TO DO", "category": "HOME", "dueDate": "2021-09-22" }, ... ]
- Sample API:
-
Scenario 2
- Sample API:
/todos/?priority=HIGH
- Description: Returns a list of all todos whose priority is 'HIGH'
- Response:
[ { "id": 1, "todo": "Learn Node JS", "priority": "HIGH", "status": "IN PROGRESS", "category": "LEARNING", "dueDate": "2021-03-16" }, ... ]
- Sample API:
-
Scenario 3
- Sample API:
/todos/?priority=HIGH&status=IN%20PROGRESS
- Description: Returns a list of all todos whose priority is 'HIGH' and status is 'IN PROGRESS'
- Response:
[ { "id": 1, "todo": "Learn Node JS", "priority": "HIGH", "status": "IN PROGRESS", "category": "LEARNING", "dueDate": "2021-03-16" }, ... ]
- Sample API:
-
Scenario 4
- Sample API:
/todos/?search_q=Buy
- Description: Returns a list of all todos whose todo contains 'Buy' text
- Response:
[ { "id": 2, "todo": "Buy a Car", "priority": "MEDIUM", "status": "TO DO", "category": "HOME", "dueDate": "2021-09-22" }, ... ]
- Sample API:
-
Scenario 5
- Sample API:
/todos/?category=WORK&status=DONE
- Description: Returns a list of all todos whose category is 'WORK' and status is 'DONE'
- Response:
[ { "id": 4, "todo": "Fix the bug", "priority": "MEDIUM", "status": "DONE", "category": "WORK", "dueDate": "2021-01-25" }, ... ]
- Sample API:
-
Scenario 6
- Sample API:
/todos/?category=HOME
- Description: Returns a list of all todos whose category is 'HOME'
- Response:
[ { "id": 2, "todo": "Buy a Car", "priority": "MEDIUM", "status": "TO DO", "category": "HOME", "dueDate": "2021-09-22" }, ... ]
- Sample API:
-
Scenario 7
- Sample API:
/todos/?category=LEARNING&priority=HIGH
- Description: Returns a list of all todos whose category is 'LEARNING' and priority is 'HIGH'
- Response:
[ { "id": 1, "todo": "Learn Node JS", "priority": "HIGH", "status": "IN PROGRESS", "category": "LEARNING", "dueDate": "2021-03-16" }, ... ]
- Sample API:
{
"id": 1,
"todo": "Learn Node JS",
"priority": "HIGH",
"status": "IN PROGRESS",
"category": "LEARNING",
"dueDate": "2021-03-16"
}
Description: Returns a list of all todos with a specific due date in the query parameter /agenda/?date=2021-12-12
[
{
"id": 3,
"todo": "Clean the garden",
"priority": "LOW",
"status": "TO DO",
"category": "HOME",
"dueDate": "2021-12-12"
},
...
]
{
"id": 6,
"todo": "Finalize event theme",
"priority": "LOW",
"status": "TO DO",
"category": "HOME",
"dueDate": "2021-02-22"
}
Todo Successfully Added
-
Scenario 1
- Request:
{ "status": "DONE" }
- Response:
Status Updated
- Request:
-
Scenario 2
- Request:
{ "priority": "HIGH" }
- Response:
Priority Updated
- Request:
-
Scenario 3
- Request:
{ "todo": "Clean the garden" }
- Response:
Todo Updated
- Request:
-
Scenario 4
- Request:
{ "category": "LEARNING" }
- Response:
Category Updated
- Request:
-
Scenario 5
- Request:
{ "dueDate": "2021-01-12" }
- Response:
Due Date Updated
- Request:
Todo Deleted
- Clone the repository:
git clone <repository-url>
- Navigate to the project directory:
cd todo-application
- Install dependencies:
npm install
- Start the server:
npm start
- Ensure you have the
todoApplication.db
SQLite database set up with thetodo
table. - Use a tool like Postman to interact with the APIs.
- Node.js
- Express.js
- SQLite
- date-fns (for date formatting)
Export the express instance using the default export syntax. Use Common JS module syntax.
This project is licensed under the MIT License.