This week I’ve been learning a little bit more about Node.js. I’ll cover what I learned and why this is used.

Description

Quite often we use Node to build backend services also called API’s(Application Programming Interface). These are the services that power our client applications like a web app running inside of a web browser or a mobile app running on a mobile device. These client apps are simply what the user sees and interact with. But these services need to talk to some services sitting on the server or in the cloud to store data, send emails or push notifications…

Why do we use Node?

  1. Node is easy to get started and can be used for prototyping and agile development.
  2. It can also be used for building super fast and highly scalable services. It’s used in production by large companies such as Paypal, Netflix, Uber, Walmart, and so on.

In fact, some studies found out that:

  • we can build twice as fast with fewer people,
  • in 33% fewer lines of codes,
  • using 40% fewer files.
  • They double the number of requests served per second
  • while decreasing the average response time by 35%

3. In Node applications, we use Javascript. So if you are a front end developer and know Javascript, you can reuse your Javascript skills and transition to a full stack developer. Simply put, you don’t have to learn a new programming language!

4. Also, because you can use Javascript both on the front end and the back end, the source code will be cleaner and more consistent. You will use the same naming conventions, the same tools and the same best practices.

5. Another reason of using Node is that it has the largest ecosystem of open source libraries available. So for pretty much any features or building blocks you want to add to your application, there is some free open source library out there that you can use.

Architecture of Node

So similar to a browser, Node is a runtime environment for Javascript code. It contains a Javascript engine that execute our Javascript code, but it also has certain objects that provide an environment for our Javascript code.

How Node works?

When the database prepares the result, it puts a message in what is called: “an Event Queue”. Node is continuously monitoring this queue in the background. When it finds an event in this queue, it will take it out and process it.

This kind of architecture makes Node ideal for building applications that include a lot of disk or network access. We can serve more clients without the need to throw in more hardware.

In contrast, Node should NOT be used for CPU(Central Processing Unit)-intensive applications like a video encoding or an image manipulation service In these kind of applications, we have a lot of calculations that should be done by CPU and few operations that touch the file system or the network.

How to install Node?

To see if you already have Node on your machine, open your terminal or command prompt and type:

To install the latest version, head over to https://nodejs.org/en/

The recommended version on the left is the latest verified version, the one on the right is the experimental one and might not be stable.

Conclusion

French guy who recently moved to the United States. I am also changing career after having worked 13 years in restaurants. I will be going into coding.