Responsive Ads Here

Sunday, 17 October 2021

Learn the MERN Stack

Learn the MERN STACK

What is the MERN STACK? Well, it consists of the following technologies. We have MongoDB Express, REACT, and NodeJs. That's what MERN stands for. So node.js is the JavaScript runtime environment that allows you to exercise JavaScript code outside of a browser, such as on a server. And Express is a web application framework for node js, it allows us to easily create a web server. And then MongoDB is the document-based open source database. So we'll be storing our data in MongoDB. The front end is react, which is a JavaScript library for building user interface. And finally, at the bottom there, we will be using mongoose, which is a simple schema-based solution to model application data. Basically, it makes it easier to use MongoDB in node js. So let's review some database concepts, we're going to just review some terminology. So what a lot of people are used to our tabular or relational databases,like databases, tables, rows, and stuff like that. So MongoDB has similar concepts that use different terms. So I just want to kind of make everyone aware of those terms. So instead of a table, we have collections, instead of rows, we have documents, we can do joint operations with the lookup operator. Instead of foreign keys, we utilize references,just a point of clarification, a lot of people talk about MongoDB as a non-relational database. But really all data is relational. So sometimes, I use the term tabular just to describe databases that must use tables. MongoDB is very best for handling data with a wide variety of relationships. We are not covering all of these concepts in the app today. But I just wanted you to be aware of some of the differences.  So let's look at the document model. This is an example of what a MongoDB document looks like.



Learn the mern stack



It looks a lot like JSON, we can see a variety of relationships and address a title, and MongoDB stores data on disk in the basic format, which stands for binary JSON. This provides a wide variety of support for data types, like strings and integers. The document model is also used for nesting documents inside each other. The subdocuments are one of the great things about the document model. So it allows us to apply the concept of data that are accessed together is stored together in an application. Another powerful feature of the document model is we also have the ability to store information inside arrays, and as I mentioned, these documents are JSON structured objects, which is how most developers think of things. for example, a person is an object who has various attributes like a job title, address, and stuff like that. This allows modern development practices to use the document model in a very good way without having to break the data apart as well, to put it into tables and normalize things. So we will be using MongoDB Atlas, which is a really fast and easy way.

MangoDb
Learn the MERN Stack

MongoDB

To get started with MongoDB some people would just run MongoDB locally on their local computer for testing. But MongoDB Atlas actually makes things a lot easier, even if you're just doing a local project. So the first step for getting started with MongoDB Atlas is to sign in. if you go to a web page, you will get this Getting Started screen. And once you've logged into MongoDB, Atlas, we need to set up a place to store the data, we need a cluster. finally here is the screen that you'll see when you first get logged in to this app. And to start building the cluster, you're going to click the New Project button, that’s the button right here.

Learn the mern stack
Learn the MERN Stack

And then after you click that you will be able to build a cluster, the big green button in the middle allows us to create and configure a cluster. So once you click that, it will bring you to this screen where you can create an A new cluster. So here you can see that in MongoDB Atlas, there's a bunch of providers, we'll be using Google Cloud Platform.  And then you can choose the region, we're going to be using the free tier today, which is going to be great for our app. And just when you're getting started and learning how to use things, I recommend starting with the free tier. Once you get things going you can easily switch to another tier later. So you just got to click a region associated with the free tier. And then, so the free tier is just the Mo sandbox, it gives a server-side server size of 512 megabytes, which is typically plenty to get started with. And then one thing to notice is that the bottom is always going to show you how much things cost. So in this case it's free and then you can click Create clusters, and then the provisioning will start. So you can see it says it's going to take seven to 10 minutes to provision. And it's often quicker than that. But you know, it’s just going to take some time to set things up.

 

As once it's created, now we are ready to get a couple of security things configured here. And finally, get a connection string. So once it's configured, you’ll be on this screen where you can set up the security.

We can handle large databases, we need to set up connections, then we can manage data, we can add, edit and delete, we can run any type of query like we do in other databases.

Express Js

Express, which is a light and lightweight, and fast web framework for Node JS cores stands for cross-origin resource sharing. And it allows Ajax requests to skip the same-origin policy and access resources from remote hosts as well. The cores package provides an express middleware that can enable cores with different options, which is going to make it so we can easily access something outside of our server from our server.

 

 Subsequent stage :- Develop a few tasks to feature in you portfolio. 


Share post in the that this aides you out. Additionally remark down the assets from which you have learned MERN Stack to help other people out.

1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete