Getting started with Node.JS

Hi Friends,

In today’s topic i am going to start on a really fresh note, as i started getting idea of Node.JS, so thought to share my view on the same. Basically, Node.JS is a platform for executing JavaScript at server side for Non-Blocking I/O, event driven model which enables fast and scalable network application. So, here we are discussing Server side code which is basically done using Java Script. Now, it is also equivalent to ASP.NET in terms of Views, Business Logic, Data Access Layer and many more things. Now, one important point to understand here, ASP.NET framework is also headed in the same direction where Node.JS is.

Now, Node.JS features talk below mentioned things:-

1) Node JS is a server side javascript framework
2) It supports modular Javascript
3) Node JS by default is asynchronous. 
4) HTTP, Networking and Web sockets are already built in here.

So, these features make Node JS fast and scalable. Now, let’s look some contrasting comparison between normal webservers and Node.exe. In normal scenarios requests are usually served as queue basis normal data structure concept as shown below in the diagram.

But, if we see Node.exe, then it is capable of serving multiple requests at a time as a confident person taking any no of requests.

Now, this asynchronous process is the default behavior of node.exe, may be because of this feature it is getting traction these days.

Now, let’s understand some of node terminology which we are going to use in our discussion.

Webserver:- Node.exe used for hosting the app
Database:- Usually Mongo DB
Scripting Language:- Javascript

Now, apart from these basic things we’ll be using ExpressRazor as a view engine for creating our views. Now, ExpressRazor, i am using because of ASP.NET MVC Razor behavior. You can also use other view engine which is meant for web forms background people like ExpressJS. But, that’s ok will focus on Razor behavior here. Now, i think this much information is quite enough to get started with Node.JS. So, let’s begin with installation 1st. Now, i am going to navigate to . Here, I’ll click on download link and install the required software. Below are the some normal screen shots of node installation.

Now, once the installation is completed. we can go into the command prompt as administrator and then simply type node, then you will notice that command prompt simply gets converted to shell. Now, here you can type script and execute simple programs as shown below in the screen shot.

Now, in the above screen shot, i have basically created one directory for my node examples and then i invoked node with the node command. Now, in there i have simply type one string and then pressed enter so it returned the same name. So, that’s basically a very simple node in a nutshell. Now, in the next segment we’ll delve more on this but for now let’s wrap. Thanks for joining me.

Rahul Sahay
Happy Coding