Necessities of a MERN Stack Developer
Published: 2021-12-23 17:14:46



**What is MongoDB?**
MongoDB is a NoSql database which is used for storing data like that document object. MongoDB stored data in JSON format. There are no structural rules. So it is an unstructured database.

**What is Mysql and Nosql?**

- Mysql:- Mysql is a structured database. Which is used to store data by the table. Mysql is a relational database.

- Nosql:- Nosql is an unstructured database. Which is not used by the data store by the table. Nosql data stored by the JSON format object. It has no relational database. It has many collections and every collection has many documents.

**What is Express JS?**
Express JS is a minimal and flexible Node JS framework that provides robust features for web and mobile applications. Express JS makes it easier to create efficient and scalable server-side applications.

**What is Node JS?**
Node JS is a JavaScript Compiler that some people say is JavaScript Runtime. Node JS actually compiles the JavaScript Code to Machine code. We can JavaScript code in the browser console because the browser has a compiler that is the name of the v8 engine. Node JS built on the Chrome v8 engine. When we need JavaScript code compiled in our device that time we need to install Node JS in our device. Node JS makes scalable network applications. Node JS is an asynchronous event driven JavaScript Compiler and Node JS built by C++ language so it's very fast.

**How does Node JS work?**
Node JS has two main concepts. Node JS is an asynchronous and Non-blocking I/O. When many clients request to the Node JS server that time the Node JS thread accepts their request and short that request process early and returns back. Which request is complex and transferred to another thread for processing the request. Node JS thread is not waiting for the one request so it is Non-blocking I/O. Node JS is executing first simple operation and then lastly executing the complex operation. We have a question in our head. Node JS has a single thread but another thread where he got it? For example, Node JS uses an external library libUV that has multiple threads. Node JS uses these threads for processing the multiple requests.


**Simple explanation of CRUD Operation**
CRUD means four operations. These are-- create, read, update and delete operations.

- Create: We can create a document of an object and store it in a database. We can post data to the server and store it in the database. To create a document we used the post method of API.

Server-Side Code Example :
app.post(‘/dataPost’, (req, res) = > {
 // operation code body here
})

Client-Side Code Example:
fetch(‘https:// localhost:5000/dataPost’, {
method: ‘POST’,
headers: { ‘content-type’ : ‘application/json’ },
body: JSON.stringify(data)
})

- Read : We can read the data from the server. We use the get method of API and display the data on our UI from the database. So get a method used for the read operation.

Server-Side Code Example:
app.get(‘/data’, (req, res) = > { //data get operation body here })

Client-Side Code Example :
fetch(‘https://localhost:5000/data’)

- Update:- When we need to update the specific document that time we update the data of the object. We use the update method of the API to update the data of the document.

Server-Side Code Example:
app.put(‘/data/:id’, (req, res) => {
 //update operation body here
})


Client-Side Code Example :
fetch(‘https://localhost:5000/data/id’, {
method: ‘PUT’,
headers: {‘content-type’: ‘application/json’}
})

- Delete:- When we need to delete a specific document that time we use the delete method of the API to delete the document from the database.

Server-Side Code Example:
app.delete(‘/data/:id’, (req, res) => {
  // delete the operation body here.
})

Client-Side Code Example :
fetch(‘https://localhost:5000/data/id’, {
method: ‘DELETE’,
})