loading...

What is NodeJs? Pros, Cons and Use Cases

shubhamsaurav profile image Shubham Saurav Updated on ・3 min read

What is NodeJs?
If we go by the official definition of NodeJs then, "It is a Javascript runtime built on Google Chrome V8 Javascript engine." But what does this even mean? And what the heck is a Javascript runtime? and what is the Javascript engine? Let's learn this one by one.

What is Javascript runtime?
A Javascript runtime is a place where our Javascript code is executed. It is like a container or an environment where our JS code is executed.

Probably you have written Javascript before. Whether you have written vanilla Javascript or used frameworks like Angular or React, you have written Javascript before and executed your code inside of a browser. The browser understands and executes our code and displays the result. In this case, the browser is the place where our Javascript code is executed. So our browser is the Javascript runtime here. But the browser is just the place where the code is executed. It uses a Javascript engine to execute the code. Now, let's talk about that.

What is the Javascript engine?
A Javascript engine is a program that executes JS code inside of a Javascript runtime. Every Javascript runtime uses a Javascript engine to execute JS code. Chrome browser uses the V8 Javascript engine which is built by Google. Mozilla Firefox uses Spidermonkey to execute JS code inside of Firefox. Internet Explorer uses Chakra to execute JS code.

Now, What is NodeJs?
So NodeJs is a place where our Javascript code is executed. It is like a container or an environment where our JS code is executed. It uses the V8 Javascript engine to execute the JS code. The V8 Javascript engine is the same engine that is used by the Google Chrome browser to execute JS code.

The NodeJs takes javascript outside the browser and executes it. It allows us to execute JS code outside the browser. And it also removes the restriction that comes with executing JS in the browser. We can do a lot more with Node than the browser. It gives us access to the filesystem. It can help us to build strong, secure, and scalable web applications.
Nowadays, NodeJs is the most popular tech which is used to build backend of a web application. It can also be used to build RESTful APIs. It gives us much much more.

The best thing about NodeJs is the community. Many many developers are using Node to build web apps, APIs, etc. So most of the problems that you will encounter have already been answered on Stackoverflow. It also has a huge library of packages which is very beneficial. You can use the packages in your projects to save a lot of time.
Now, let's talk about when you should use NodeJs? and most importantly when you shouldn't use Node?

When you should use Node?
Whenever you are building data-intensive applications, Whenever you are building an app that will have lots and lots of data then Node JS is the best choice. For example, Video- Streaming apps, chat applications, or any other realtime application.

When you should not use NodeJS?
Whenever you are building CPU-intensive applications, then Node is not a good choice. You should use another tech like Django, Flask, Ruby on Rails, etc. Node is not good for CPU-intensive apps or apps which require heavy server-side processing. Examples of CPU-intensive apps are Image manipulation apps, Video conversion apps, Video compression apps. Their apps require heavy server-side processing and thus, Node is not the best choice for building these kinds of apps.

Now, let's talk about the companies that are trusting Node for their apps.
Netflix, Uber, PayPal are some of the companies which trust and use Node for their apps.

Alright, this is enough for a very high-level introduction to NodeJs. If you want to watch the video version of this article then click on the link here.


Connect With Me:
Youtube: ShubhamSauravYT.
Twitter: @hiShubhamSaurav
Instagram: @hiShubhamSaurav
Facebook: @hiShubhamSaurav

Posted on by:

shubhamsaurav profile

Shubham Saurav

@shubhamsaurav

Writing Restful APIs using JS. Learning to code in Go(Golang)

Discussion

markdown guide
 

This is the first time I have written an article. Please point out the mistakes and give me some writing tips.