Recent Posts

MERN stack project setup



I. Create express and node js server:

  1. First Create a empty folder as project 
  2. And create a server.js file in it 
  3. Open the terminal and go to project directory
  4. 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:

  1. Now download and install mongodb in your PC 
  2. Add the path of the mangoDb bin to the environment variable
  3. Go to terminal, $ mongo => To start the server 
  4. In that console, we can you sql operations like $show dbs
  5. Or we can install Robo 3T 

III. React: 

  1. Now create a React folder in project folder 
  2. 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