I will giving few instance how do we use Node, MongoDB, ReactJS, and Express.
React: Front-End Library
Why use React?
Virtual DOM – A virtual DOM object is a representation of a DOM object. Virtual DOM is actually a copy of the original DOM. Any modification in the web application causes the entire UI to re-render the virtual DOM. Then the difference between the original DOM and this virtual DOM is compared and the changes are made accordingly to the original DOM.
Components – ReactJS supports Components. Components are the building blocks of UI wherein each component has a logic and contributes to the overall UI. These components also promote code reusability and make the overall web application easier to understand.
High Performance – Features like Virtual DOM, JSX and Components makes it much faster than the rest of the frameworks out there.
You can start your react application by first installing “create-react-app” using npm or yarn.
npm install create-react-app --global
yarn global add create-react-app
Node.js: JS Runtime Environment
Why use Node.JS?
Single threading – Follows a single-threaded model.
Initialize a Node.js application by typing running the below command in the command window. Accept the standard settings.
Express: Back-End Framework:
Express is a Node.js framework. Rather than writing the code using Node.js and creating loads of Node modules, Express makes it simpler and easier to write the back-end code. Express helps in designing great web applications and APIs. Express supports many middlewares which makes the code shorter and easier to write.
Why use Express?
Asynchronous and Single-threaded.
Efficient, fast & scalable
Has the biggest community for Node.js
Express promotes code reusability with its built-in router.
Create a new folder to start your express project and type below command in the command prompt to initialize a package.json file. Accept the default settings and continue.
Then install express by typing the below command and hit enter. Now finally create a file inside the directory named index.js.
npm install express --save
MongoDB: Cross-platform Document-Oriented Database
Why use MongoDB?
Fast – Being a document-oriented database, easy to index documents. Therefore a faster response.
Scalability – Large data can be handled by dividing it into several machines.
Schema Less – Any type of data in a separate document.
Data stored in the form of JSON –
Objects, Object Members, Arrays, Values, and Strings
JSON syntax is very easy to use.
JSON has a wide range of browser compatibility.
Sharing Data: Data of any size and type(video, audio) can be shared easily.
Simple Environment Setup – Its really simple to set up MongoDB.
Flexible Document Model – MongoDB supports document-model(tables, schemas, columns & SQL) which is faster and easier.
Creating a database: Simply done using a “use” command:
Creating a table: If the collection/table doesn’t exist then a new collection/table will be created:
Inserting records into the collection:
"id" : 1,
"Name" : "Klaus",
"Organization": "Geeks For Geeks"