Another todo application with the following features:
The data model of a todo item is:
interface Todo {
id: number;
title: string;
completed: boolean;
dueDate: Date;
createdAt: Date;
}
The requirements of the application are
- Add and remove todo items
- Search todo’s by title
- Filter by completed
Create a .env file
npm install
Before starting the json server copy the contents of db.base.json
into db.json
json-server --delay 50 --port 3004 db.json
You can ignore this step if you use InMemory Repository (look .env file)
npm run dev
I decided to just add a few tests to showcase the test framework.
Note: The tests only work for JsonServer Repository
json-server --delay 500 --port 3004 db.json
npm run test
- The sorting logic is incorrect because the JsonServer Repository does not support date comparison.
- State management can be improved by utilizing React context.
- Currently, the project is deployed using an InMemory Repository. It may be worth considering hosting a dedicated server for the backend instead.