What is MERN?
You must have heard of MERN Stack buzzing around lately, but what IS ‘MERN Stack’, why is it getting so popular, what can one achieve through this? We will be answering these questions below.
MERN Stack is basically a JavaScript Stack that provides an end-to-end framework for building dynamic web applications.
It consists of 4 powerful technologies:
* Mongo DB: A document-based open source database
* Express: A Node.js framework
* React: A is a JavaScript front-end library that is used for building user interfaces
* Node.js: A JavaScript Environment which allows the user to run their code on the server (outside the browser)
Don’t worry if you don’t understand any of it right now, we will be exploring each of them one by one.
MongoDB
Mongo DB is a non-relational or NoSQL Database. It stores data in flexible, JSON-like documents, meaning fields can vary from document to document and data structure can be changed over time.
A lot of people are used to the Relational Database concepts, Mongo DB has similar functions with some different terminology. Let’s review some of them.
Now, MongoDB Documents looks very similar to JSON format. MongoDB on disk stores the data in BSON format, which stands for Binary JSON and thus is able to support a wide variety of data types.
{
“name”: “Sun Bakery Trattoria”,
“stars”: 4,
“categories”: [ “Pizza”, “Pasta”, “Italian”, “Coffee”,
“Sandwiches” ]
}
More information about MongoDB can be found on https://www.mongodb.com/what-is-mongodb. We will explore more of it in the upcoming blogs.
Express
Express is basically the back-end framework that is used in the MERN stack. It is a minimalist web framework for Node.js. Instead of writing code using Node.js, Express makes it easier and simpler to write back-end of the application. Express supports many middlewares which makes the code shorter and easier to write.
To get Express, one simply has to hit
$ npm install express --save
React
React is a front-end JavaScript library for building user interfaces. It is created by Facebook.
React is declarative, that is you can design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes.
It is component-based. You can build encapsulated components that manage their own state, then compose them to make complex UIs.
Installing react on your machine just takes one simple command
$ npm install create-react-app --global
In order to create a project in React use:
create-react-app name_of_application
Node
Node.js provides a JavaScript Runtime Environment which allows us to run our code on the server (outside the browser). It uses Node Package Manager (npm) through which you can download from thousands of free packages and can integrate them into your project.
In order to create a node project simply hit
$ npm init
it then asks you to fill in some basic information and to run your project hit
$ npm start
Now, that you know what is Mongo DB, React, Node.js, and Express, you know what is MERN Stack. Now we hope that you got a clearer picture of it, in case of further queries, don’t hesitate to comment below.
HAPPY CODING!!