Node.js - What is it ? Why to learn it ?

what is Nodejs? why to study nodejs ? how to study nodejs ? MEAN stack ? angularjs , expressjs, mongodb, mvc architecture, javascript, nosql database systems

Node.js is Javascript code running at the server-back-end, developed by Ryan Dahl in starting 2009, and is now maintained by Joyent. To execute javascript on the server, it needs to be interpreted and executed. Here comes Node.js ! By using Google's V8 VM, it executes the Javascript code at the server. Thus a run-time Javascript based environment is created by Google's V8 engine.

Node.js has many integrated modules. For eg : As you would need a Web listener for languages like PHP, and it would be Apache, Lighttpd or anything else. But you do not need that web listener with Node.js. When we install Node.js, many such libraries are imported, which helps us to couple the functionality within the application.

An application written in Node.js has basically two advantages [Author's view only :)]

1. The coding language is consistent i.e. We code in Javascript throughout. Server pages, Client pages, web-server pages, all are coded in Javascript. This makes the life of a developer relatively easy. Unlike otherwise, we would have to play with PHP / Python / Ruby on the server, and Javascript + Jquery + HTML on the client, with Apache / Lighttpd doing the web listener activities.

2. It becomes really tough for a developer when functionality like real time chat comes into picture. Not many years ago, functionality like these were a star wars like situation for a developer and the company with such features was a tremendous hit in the world [Remember Yahoo chat-rooms ? :)]. It required a team of Einstein - like developers to code for several months to bring out such a prototype, and eventually the code was tremendous amount of hacks ! With Node.js you can do the same on a Christmas eve ! In a nut-shell, with the advent of new standards of HTML web changed and brought in new features like web-sockets and many more, development became relatively very easy. Node.js has libraries which are revolutionizing the development cycle, and it is even growing bigger with people jumping with new libraries. Thus at the end of the day, you would code less and see more turn - about in your application. Not to forget that there is a great community to help, if you are stuck with the code !

If you Google about Node.js, you will notice that it uses 'Event-driven, non-blocking I/O, single-threaded event loops and asynchronous callbacks' model for doing the data-intensive real-time work.

Having said those fancy words, if you do not understand too much of it, do not trouble yourself too much. You will get it all as you start learning Node.js.

Node is often used with Expressjs, Angularjs, MongoDB. Together they combine to form a MEAN stack. Remember LAMP (linux, apache, mysql, php/python/perl) ?

Expressjs, is a open sourced lightweight framework for Node.js for organizing your code into MVC architecture and makes it even easier by integrating third party modules and various aspects into your web application. It reduces your code at least by 3x.

Angularjs is a Javascript framework maintained by Google available for free as a open source. Used for making browser based single-page applications (but it is not a constraint ! you can make multiple pages web app using angular), and maintaining the MVC architecture. Its purpose is to serve dynamic content through 2-way data binding and hence accomplishing automatic synchronization of the models. In short, it has the tools which will help you make a real time, single page web application.

Mongo DB is a NOSQL, document oriented database system. It has the added advantage of storing the JSON as-it-is into the database. Is a full featured database system, with the capabilities of load balancing, clustering and even acting as a file system.

Thus you see that even when we are using frameworks to make our work even easier, its all pure Javascript. Its not that you have to be a master in Javascript before learning Node, but you should be able to recognize Javascript code :)

At the end I would recommend learning Node.js, even if not for development but for fun. Its a whole new world of real time data delivery from the server to the browser.

Its no rocket science ! Its Node.js !

Tune in for the up-coming series for learning Node.js in a very simple way, the way I have learned it. I am no developer, neither I am a high end developer, I love to learn new technologies [and play with them, If I am able to grasp them :)] and I learned a bit of Node.js quickly. I will share it here in the upcoming posts.