MERN stack project setup
I. Create express and node js server:
- First Create a empty folder as project
- And create a server.js file in it
- Open the terminal and go to project directory
- Now in terminal,
$ npm init => Creates a package.json file
$ npm install express --save
$ npm install body-parser
$ npm install nodemon
In server.js file,
Const express = require (‘express’);
Const app = express();
app.listen(3000, function(){
console.log (“server started”)
});
To create a express server
II. MongoDB:
- Now download and install mongodb in your PC
- Add the path of the mangoDb bin to the environment variable
- Go to terminal, $ mongo => To start the server
- In that console, we can you sql operations like $show dbs
- Or we can install Robo 3T
III. React:
- Now create a React folder in project folder
- Go to the React directory in terminal and
$ npx create-react-app my-app
$ cd my-app
$ npm start => to start the react website
** You should also install the plugins or packages in your editor of choice.
- We can also install the package for the react from terminal like
For routes=> $ npm install react-router-dom
For axios=> $ npm install axios
For redux=> $ npm install redux
$ npm install react-redux
For avatars=> $ npm install react-avatars
For React thunk=> $ npm install react thunk
No comments
If you have any doubts, Please let me know