![]() |
VOOZH | about |
In the fast world where there is no time for people to cook food or go to restaurants to eat, Food Delivery applications are one of the best options for them. In this tutorial, you will learn how to create a simple food delivery app using MERN stack. Our application will allow users to browse through a list of restaurants, view their menus, and add items to a shopping cart.
Preview of final output: Let us have a look at how the final output will look like
👁 Screenshot-2567-01-28-at-083224-(2)
Step 1: creating the folder for the project
mkdir food-delivery-app
cd food-delivery-app
Step 2: Create a backend using the following commands
mkdir backend
cd backend
npm init -y
Step 3: Install the required dependencies.
npm i cors express mongoose nodemonBackend Dependencies:
"dependencies": {
"cors": "^2.8.5",
"express": "^4.18.2",
"mongoose": "^8.0.3",
"nodemon": "^3.0.2"
}
Example: Create server.js file and add the following code.
Step 4: To start the backend run the following command.
nodemon server.jsStep 5: Go to the root directory of the application and create the frontend application.
npx create-react-app client
cd client
Step 6: Install important dependencies: axios
npm i axiosFrontend dependencies:
"dependencies": {
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"axios": "^1.6.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.21.1",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
}
Example: Create the required files and add the following code.
Step 7: To start the frontend run the following command.
npm startOutput: