Introtuction to Node.js

Photo by: NodeJs

This week I have been really busy, It's been a real challenge to get this post out. I haven't manage to get some buffer between my writing and releasing posts, but I definitely will do this in near future. This post will be about Node.js, simply because I was busy with it in whole weekend with my work tasks. I have using Node.js a month now and I still find that I don't get the point of Node.js or I feel like I misuse it. So I decided to take a closer look.

What is Node.js?

Node.js is a server-side platform built on Google Chrome's Javascript engine (V8). It's incredibly fast. As I mentioned, it is built on Javascript engine, so most developers are familiar with javascript and easier to get started with. Node.js have incredible package ecosystem, npm. That is the largest ecosystem of open source libraries in the world.

When should I use Node.js?

Node.js is a perfect solution in following areas:

  • Data streaming applications.

  • Data Intensive Real-time applications.

  • JSON APIs based Application.

  • Single page application.

  • I/O bound application.

The bad part

As I mentioned earlier, Node.js has the largest package ecosystem - this is a really good advantage for those who know how to use it. The problem is when a new developer starts to use Node.js and his/her knowings about Node.js are minimum. The result will be package hell - where for a small functionality is used a lot of packages. Some packages are old, and no one hasn't maintained them for years. So to see what packages are good and what bad, we need to understand Node.js.

What should I know, before starting?

Learning Node.js can be really challenging. From my experience, the best way to get started would be:

  • Learn and understand latest ECMA script (right now it's ES6). Yes, that mean before getting started, make sure you understand functions, callbacks, promises, prototypes, classes, closures and so on.

  • Understand the non-blocking Node environment. Again this includes callbacks, promises, async patterns and so on.

  • Learn the global variables.

  • Learn the concurrency model.

As you see, we need to have really good javascript base. I'm not saying that, if you don't know all these things that I mentioned earlier you will fail with Node.js. No, don't worry. You will build something on Node.js but this will come with pain. Trust me, I have been on this road, or should I say - I'm on this road :).

So my advice, before getting started with Node.js is, understand the javascript.

Available resources