Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
77 views
9 pages
Todo List Application Using MERN
Todo List Application using MERN
Uploaded by
Ronny Camacho
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save Todo List Application using MERN For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
77 views
9 pages
Todo List Application Using MERN
Todo List Application using MERN
Uploaded by
Ronny Camacho
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save Todo List Application using MERN For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 9
Search
Fullscreen
TutorialsDSAData ScienceWeb TechCourses oS Databases SQL MySQL PostgreSQL PL/SQL _MongoDB SQLCheat Sheet SQL Interview Questions Todo List Application using MERN Last Updated : 27 May, 2024 Todo list web application using MERN stack is a project that basically implements basic CRUD operation using MERN stack (MongoDB, Express JS, Node JS, React JS). The users can read, add, update, and delete their to- do list in the table using the web interface. The application gives a feature to the user to add a deadline to their task so that it user can be reminded of the last day to complete the project Preview of final output: Let us have a look at how the final application will Look like. Todo List Todo List Add Task me ote | ene [est a Compe Asignrent Conpkted rornare3. 2coon mt ESE ek ss raj comptes sz0m EE sas Practice O54 Congeingttiane3 7cocor frees ene bug reniogtarinen.escoom GRE —— 5 = Technologies used / Pre-requisites:* MongoDB Express JS React JS Node JS HTML, CSS, JavaScript Requirements: Nodes installed in your machine. MongoDB installed locally or use MongoDB Atlas online. Code editor (Recommended : VS code) Approach to create Todo List: * In frontend, the react component called “Todo” is used to display tasks, deadlines and its status and form to add new todo item with edit and deletion feature. In backend, application fetches data from MongoDB using backend API called ‘/getTodoList”. New data can be added to the database using ‘faddTodoList” API. ‘JupdateTodoList/id” API is used to edit the existing specific data from the table. ‘/deleteTodoList/‘id” API is used to delete the specific data from the table. Functionalities Of Todo Application: * Add new todo: User can add new todo task using the form. On clicking “submit” button, The new data will be saved to database. * Display todo list: User can view the todo list in table format. * Edit existing data: User can click on “Edit” button to make the table row to editable fields. On clicking “Edit” button, new buttons call “Save” and“Reset” will be created, “Save” button is to update the edited data to database. “Reset” button is to reset the data in the field. * Delete existing data: User can click on “Delete” button available in the table row to delete the data from database. Project Structure: Steps to create the project: Step 1: Create directory for project. mkdir Todo-List Step 2: Create sub directories for frontend and backend. Open Todo-List directory using following command cd Todo-List Create separate directories for frontend and backend. mkdir frontend mkdir backend Use “Ls” command to list created folders. Is Step 3: Open backend directory using the following command.cd backend Step 4: Initialize Node Package Manager using the following command. nom init odo-List> ate ele odo-List Step 5: Install express, mongoose and cors package in backend using the following command npm install express mongoose cors Step 6: Come back to Todo-List folder (project main folder). cd w./ Step 7: Open frontend directory using the following command cd frontend Step 8: Create react application in the current directory using the following command. npx create-react-app . Step 9: Install bootstrap, axios and react-router-dom package in backend using the following command. npm install bootstrap axios react-router-dom Step 10: Open Todo-List using your familiar code editor. Come back to Todo-List folder (project main folder) cd ./If you are using VS code editor, run the following command open VS code in current folder. code » Step 11: Navigate to frontend directory in code editor. Step 12: Delete files inside ‘src’ folder and ‘public’ folder (Don't delete folder) Step 13: Add files in frontend directory as per the project structure with below code. Step 14: Navigate to backend directory in code editor. Step 15: Create serverjs and model file as per project structure. Step 16: Add files in backend directory as per the project structure with below code. Step 17: Replace database connection URL with your own connection URL in serverjs file. Final Project Structure should be Like this, The updated dependencies in package.json for frontend will look like: "dependencies": { "@testing-Library/jest-dom": "5.17.0", "@testing-library/react": "13.4.0", "@testing-Library/user-event": "13.5.0", "axios": "41.5.8","bootstrap": "95.3.2", "react": "18.2.8", “react-dom": "18.2.0", "react-router-dom": "6.16.6", “react-scripts": "5.0.1", "web-vitals": "42.1.4" The updated dependencies in package.json for backend will look like: "dependencies": { "cons": "*2.8.5"s "express": "*4.18.2", "mongoose": "47.5.2" Example : Write the following code in respective files Frontend code: * Appjs: This is our main file which routes to the Todo component. * Todo,js: This component contains all the logic for displaying Tasks, Status of tasks and deadlines of the tasks fetched from database in table format, adding new todo list to database, deleting existing todo from database and editing existing todo in database. HTML JavaScript JavaScript JavaScript
&
Todo List
You need to enable JavaScript to run this app.
Backend:* Server.js: This is a file which contains logic to start the backend server, APIs to interact with database. * todoListjs: This is a model file called a wrapper of the Mongoose schema. This file is used to define the schema of table that stores the todo list. JavaScript JavaScript server. js const express = require(‘express’) G _ const mongoese = require( mongoose" ) const cors = require(‘cors') const TodoModel = require("./models/todoList*) var app = express(); app.use(cors()); app.use(express.json()); // Connect to your MongobB database (replace with your database URL) mongoose. connect ("mongodb: //
[email protected]
/todo"); // Check for database connection errors mongoose.connection.on("error”, (error) => { corsole.error("NongobB connection error:", error); ns // Get saved tasks from the database app.get("/getTodolist", (req, res) => { TodoMocel.Find({}) sthen((todeList) => res.json(todeList)) seateh((err) => res.json(err)) ns // Add new task to the database app.post("/addTodolist", (req, res) =: TodoNodel .create({ task: req.body.task, status: req.body.status, deadline: req.body.deadline, » -then( (tode) scatch((err) res. json(toca) ) res. json(err)); ns // Update task fields (including deadline) app.post("/updateTodoList/:id", (req, res) const id = req.params.ids const updateData - { task: req.bedy. task, status: req.body.status, deadline: req.body.deadline, i TodoMocel.findByIcAndUpdete(id, updateData) «then((tode) => res. json(toco)) seateh((err) => res. json(err))5 ns// velete task fron the database app.delete("/deletetodoList/:id", (req, res) => { const id = req.params.id; TodoMocel. fincByIcAndDelete({ _id: id }) «then((tode) => res. json(toco)) seatch((err) => res.json(err))5 ns app. listen(3001, () => { corsole,log('Server running on 3¢01°); ns Steps to run application: Step 1: Open Todo-List/backend folder in new terminal / command prompt. Step 2: Execute the command to start backend API server. npm start Now, our backend server is running in localhost on port 3001 http: //localhost :3061/ Step 3: Open Todo-List/frontend folder in another new terminal / command prompt. Step 4: Execute the following command to run react app. npm start Open the browser and navigate to the following link to open the application. http: //localhost : 30¢e/ Output:todolist-demo Tedo list application using MERN Want to be a Software Developer or a Working Professional looking to enhance your Software Development Skills? Then, master the concepts of Full-Stack Development. Our Eull Stack Development - React and Node,js Course will help you achieve this quickly. Learn everything from Front-End to Back-End Development with hands-on Projects and real-world examples. This course enables you to build scalable, efficient, dynamic web applications that stand out. Ready to become an expert in Full-Stack? Enroll Now and Start Creating the Future! © mani... 6 Previous Article Next Article ‘Address Book using MERN Food Delivery Application using MERN Stack Similar Reads Todo List CLI application using Node.js CLI is a very powerful tool for developers. We will be learning how to create a simple Todo List application for command line. We have seen TodoList as a. 13 min read Todo List Application using MEAN Stack
You might also like
Step-by-Step Tutorial - Building A MERN Stack Application From Scratch
PDF
No ratings yet
Step-by-Step Tutorial - Building A MERN Stack Application From Scratch
14 pages
Getting Started With The MERN Stack
PDF
100% (1)
Getting Started With The MERN Stack
11 pages
MERN
PDF
No ratings yet
MERN
8 pages
Mern Stack
PDF
No ratings yet
Mern Stack
17 pages
Ajay Mern Stack Final Assignment Coding
PDF
No ratings yet
Ajay Mern Stack Final Assignment Coding
9 pages
Resume Builder Web Application: Project Description
PDF
100% (1)
Resume Builder Web Application: Project Description
11 pages
Unit 5
PDF
No ratings yet
Unit 5
66 pages
Full Stack Curriculum.
PDF
No ratings yet
Full Stack Curriculum.
8 pages
Address Book Using MERN
PDF
No ratings yet
Address Book Using MERN
13 pages
Simple Todo List Application
PDF
No ratings yet
Simple Todo List Application
6 pages
NOTES 5.2 (React Todo)
PDF
No ratings yet
NOTES 5.2 (React Todo)
3 pages
Mern Crud Guide
PDF
No ratings yet
Mern Crud Guide
4 pages
MERN Simple Project
PDF
No ratings yet
MERN Simple Project
6 pages
ReactJS Test Experience - New
PDF
No ratings yet
ReactJS Test Experience - New
3 pages
MERN Todo Project
PDF
No ratings yet
MERN Todo Project
3 pages
Mobile App Development
PDF
No ratings yet
Mobile App Development
3 pages
How To Build A MERN Stack To-Do App
PDF
No ratings yet
How To Build A MERN Stack To-Do App
3 pages
EATSY Food Website Reactdxjsbcdxja
PDF
No ratings yet
EATSY Food Website Reactdxjsbcdxja
8 pages
Week 2 - Assignment
PDF
No ratings yet
Week 2 - Assignment
2 pages
Ex 2 TODO AppN
PDF
No ratings yet
Ex 2 TODO AppN
11 pages
Taks 1 - Git Project
PDF
No ratings yet
Taks 1 - Git Project
7 pages
ToDo App
PDF
No ratings yet
ToDo App
13 pages
Ajay Create A Todo App Code
PDF
No ratings yet
Ajay Create A Todo App Code
5 pages
WE Notes Unit - III, IV Complete (R-18)
PDF
No ratings yet
WE Notes Unit - III, IV Complete (R-18)
36 pages
Software Training - ReactJS API and C# v1.1
PDF
No ratings yet
Software Training - ReactJS API and C# v1.1
6 pages
FSWD Lab
PDF
No ratings yet
FSWD Lab
50 pages
Create A TODO Application in React With Necessary Components and Deploy It Into Github.
PDF
No ratings yet
Create A TODO Application in React With Necessary Components and Deploy It Into Github.
12 pages
Todo List API Synopsis
PDF
No ratings yet
Todo List API Synopsis
5 pages
Todo - App: 1. Project Setup React Environmen
PDF
No ratings yet
Todo - App: 1. Project Setup React Environmen
11 pages
Arsaluddin Resume
PDF
No ratings yet
Arsaluddin Resume
1 page
MERN Premium Brochure
PDF
No ratings yet
MERN Premium Brochure
14 pages
Crud Todo App
PDF
No ratings yet
Crud Todo App
11 pages
MERN Stack Learning Roadmap
PDF
No ratings yet
MERN Stack Learning Roadmap
2 pages
ToDo List Application
PDF
No ratings yet
ToDo List Application
6 pages
React Js
PDF
No ratings yet
React Js
34 pages
153 Internship Report
PDF
No ratings yet
153 Internship Report
36 pages
Ques 1
PDF
No ratings yet
Ques 1
3 pages
Challenge React PDF
PDF
No ratings yet
Challenge React PDF
4 pages
Updated Todo List
PDF
No ratings yet
Updated Todo List
4 pages
Frontend Task
PDF
No ratings yet
Frontend Task
3 pages
SPP 5 Aniket
PDF
No ratings yet
SPP 5 Aniket
3 pages
ATHIL
PDF
No ratings yet
ATHIL
47 pages
ReactJs Step-By-Step Tutorial Series - Part 4 - Build ToDo Application Using ReactJS - by Jinal Shah - Medium
PDF
No ratings yet
ReactJs Step-By-Step Tutorial Series - Part 4 - Build ToDo Application Using ReactJS - by Jinal Shah - Medium
19 pages
Todo List Project PDF
PDF
No ratings yet
Todo List Project PDF
14 pages
Resume Builder
PDF
No ratings yet
Resume Builder
35 pages
Full Stack Curriculum.
PDF
No ratings yet
Full Stack Curriculum.
8 pages
Scotch Io Tutorials Creating A Single Page Todo App With Node and Angular Fbclid IwAR1UyBth4V9M1N61nmNiX2LNv7aQb6SvdYGy5fGuJydW4l sSS9iX8ZrSo
PDF
No ratings yet
Scotch Io Tutorials Creating A Single Page Todo App With Node and Angular Fbclid IwAR1UyBth4V9M1N61nmNiX2LNv7aQb6SvdYGy5fGuJydW4l sSS9iX8ZrSo
19 pages
Okay
PDF
No ratings yet
Okay
22 pages
React 4
PDF
No ratings yet
React 4
6 pages
Introduction To The To Do List Application
PDF
No ratings yet
Introduction To The To Do List Application
13 pages
React Sample Project
PDF
No ratings yet
React Sample Project
3 pages
Final Py
PDF
No ratings yet
Final Py
12 pages
React Lab Manual
PDF
No ratings yet
React Lab Manual
30 pages
General File Structure
PDF
No ratings yet
General File Structure
24 pages
Miniproject To DO APP
PDF
No ratings yet
Miniproject To DO APP
25 pages
PHASE 2 APIDevelopmentand
PDF
No ratings yet
PHASE 2 APIDevelopmentand
5 pages
Lab10 - REST API With DB
PDF
No ratings yet
Lab10 - REST API With DB
5 pages
ToDoList Project Report
PDF
No ratings yet
ToDoList Project Report
3 pages
React Todo
PDF
No ratings yet
React Todo
6 pages
Full Stack Development
PDF
No ratings yet
Full Stack Development
3 pages
Top 20 Mern Stack Advanced Projects
PDF
No ratings yet
Top 20 Mern Stack Advanced Projects
11 pages
Building Full-Stack Applications With MERN Stack - Comprehensive Guide
PDF
No ratings yet
Building Full-Stack Applications With MERN Stack - Comprehensive Guide
13 pages
Refresh Auth Token Rotation (Node Js & React) - Part 1
PDF
No ratings yet
Refresh Auth Token Rotation (Node Js & React) - Part 1
21 pages
Refresh Auth Token Rotation (Node Js & React) - Part 2
PDF
No ratings yet
Refresh Auth Token Rotation (Node Js & React) - Part 2
21 pages
Expense Management System Using MERN Stack
PDF
No ratings yet
Expense Management System Using MERN Stack
28 pages