This is a simple To-Do List application with the following features:
-
Create Tasks: Users can create tasks with a title and description.
-
View Tasks: Users can view a list of all tasks.
-
Mark as Completed: Users can mark tasks as completed.
-
Edit Task Details: Users can edit task details.
-
Delete Tasks: Users can delete tasks.
Tasks are stored and retrieved from a simple database. Currently, we use MySQL/MongoDB for data persistence.
-
Task Title Validation: Validation is implemented to ensure that task titles are not empty and the password is abc.
-
Mark as Completed Validation: Users can't mark a task as complete if it's already marked as such.
-
Error Handling: Errors are handled gracefully, and meaningful error messages are provided.
-
Navigate to the
backend
directory:cd server
-
Install Dependencies: Run
npm install
to install the required dependencies. -
Run the Application: Execute
npm start
to start the application. Password is abc.
I also have completed a frontend in React:
- Navigate to the
frontend
directory:cd client
- Install Frontend Dependencies: Run
npm install
in the frontend directory. - Run the Frontend: Execute
npm run dev
to start the React application.
-
Creating a Task: Use the provided endpoint to create a new task with a title and description.
POST /todos
-
Viewing Tasks: Retrieve a list of all tasks using the following endpoint.
GET /todos
The response will be in a JSON format, providing a clear list of all tasks.
-
Editing Task Details: Modify the task details using the following endpoint.
PUT /todos/:id
-
Deleting Tasks: Remove a task by using the delete endpoint.
DELETE /todos/:id
-
Authentication: Login to start editing password is abc.
POST /login
The code is organized as follows:
app.js
: Entry point of the application.routes/tasks.js
: Handles the CRUD operations for tasks.models/taskModel.js
: Defines the task schema and interacts with the database.config.js
: Contains the database configuration.
Tasks can be categorized by introducing a "category" field in the task schema.
Feel free to explore and extend the application based on your needs!
Note: This is a basic To-Do List application, and further improvements and optimizations can be made based on specific requirements.