Posts

Using MongoDB in The Cloud with Atlas

Image
In this blog I'am going to show you how to set up MongoDB Atlas.Atlas allows you to have MongoDB which is a NoSQL database in the Cloud so that you don't have to have it in your Local machine.So let's get started! So first thing you want to do is go to  https://www.mongodb.com/  . Go to Products on the top and choose MongoDB Atlas which is the first option. Now this page should appear.Next you have to either Sign up or Login if you already have an account.If you don't have an account click on the button "Start free" it will take you to the sign up form.If you do have an account click on the Sign in button. After you sign in successfully you will be directed to your Atlas account. Now click on build a Cluster option.Then you will be taken to the Global Cluster configuration page. In the configuration page there are a few options to select.First you need to pick your cloud provider.You can pick any provider you like for this. H

Introduction to Express js

What is Express JS? Express is a fast, unopinionated and minimalist web framework for Node.JS. So what does unopinionated and minimalist mean? Unopinionated basically means that it's not a high-level framework(basic at it's core) and it doesn't assume how you're going to built the app like a certain design pattern you have full control of how you handle requests to the server and how you respond which is also why it's minimalist. Express is a "server side" or "Back-End" framework.Express can be used with Front-End frameworks like React,Angular & Vue to built full stack applications. Mostly Express is used to built the API so that it can take requests from the front end and it serves back data usually in JSON format which can be used to render the front-end. Why use Express? Makes building web applications with Node.Js much easier  If you use Node itself to make the back-end it would be much harder and much more coding. Us

Using React Router

What is React Router? React Router is a routing library built on top of react and is used to create routes for different links and giving access to them.So React Router is a very important module of React. So let's see how this works Installing React Router First you need to get react-router-dom(After installing React  with npx create-react-app ) npm install react-router-dom Now lets say we have 2 components users.js and home.js.(App.js as well if you installed React using create-react-app method). Users.js import React from 'react' class Users extends React.Component { render() { return <h1>Users</h1> } } export default Users Similar two for home.js and App.js Now import these 3 files to index.js file as below. import React from 'react' import ReactDOM from 'react-dom' import './index.css' import App from './App' import Users from './users' import Home from './home' ReactDOM.rend

Introduction to NODE.JS

Image
What is NODE.JS? Node.js is a JavaScript run-time.The language used is JavaScript.So Node.js is not a language or a framework or some library.So basically it's JavaScript running in your machine instead of browser which what was used to be done traditionally. It's been built on the V8 JavaScript engine(same engine Google Chrome is built on) .Node and V8 is mostly written in C++ language which is also very efficient and fast. So all this essentially means that we can use JavaScript as a server side language. Why  use NODE? Fast, efficient and highly scalable. Event driven,non-blocking I/O model.(will be explained down below) Popular in the industry. Same language on the front-end and back-end. NON-BLOCKING I/O used by NODE Node.js is non-blocking and asynchronous, It runs on a single thread using non-blocking I/O(Input/Output) calls.This single thread can support thousands of connections which are held in what called an event-loop.This method optimizes th

What is a Callback? - JavaScript

Image
Callback function is a function that is to be executed after another function has finished executing. So let's take a function that takes a function as an argument.This is possible because JS consider's functions as objects.So any function that is passed as an argument is called a Callback function.Now let's look at some examples. So why do we need Callbacks? You might already know that Java Script is an event driven language.This means that Java Script does not wait for responses from any event that takes time like I/O operations, Instead it keeps executing the code while listening to other events.This becomes a problem sometimes.Let's see why The output of this function will be 1,2 in order respectively as expected. No problem here.But what if the first function takes some time to execute?Like an API request that needs to wait for a response from the server.Let's look at an example related to this scenario.To do this we're going to use the function s

Difference between var,const and let in JavaScript

Image
Hello guys, In this post I will talk about the difference between var,const and let features used in JavaScript for variable declaration and how we can use them for coding.First we will talk about the var feature which is what most people are usually more familiar with. VAR Var declarations basically have 2 types of scopes.Global scope and function/local scope.If the variable is globally scoped it can be only accessed globally(cannot be accessed inside functions).If the variable is declared inside a function the variable can only be accessed from inside the function. Now let's look at an example to understand this more clearly. Here "object" is global scoped and "object2" is function scoped.Therefore the console output would be an error saying object is undefined. Now that we understand  the scope of Var lets look at two basic features of it. Var variables can be re-declared and updated Var variables can be re-declared and updated in the same s

GitHub Repository creation + Adding files through Git Bash Terminal

Image
Hello everyone, I'am going to show you how to create a basic GitHub Repository and add your files to the created Repository using the Git Bash terminal. First you must create an account at the GitHub website.Once you have created the account in the left you will see the repository section.Now Click on the button called new in that section.This will take you to the repository creation page. Now simply enter any name you want and choose the type(public or private) and click on Create repository button.If you go to the homepage now you will see the newly created repository in the repository section.Okay,now that we have created a repository lets see how we can add files to it. First you need to download and install Git Bash.(https://git-scm.com/downloads).Once you have installed it open the Git Bash terminal using the start menu.Now there are a few commands you need to input into the terminal.So now I will show you step by step the commands you have to input. First what yo