Node JS – Part 2

Hi Friends,

Today in this section, will move a bit and install node js extension for visual studio. Now, one point to note here that this tool is an extension to visual studio, hence it won’t work with free edition of visual studio. you need to have license edition of visual studio for implementing the same. So, you need to download the extension from the link Now, once NTVS installation is done, then you can see the node templates in JavaScript section as shown below in the screen shot.

Now, all these templates are quite educational. you can easily grasp the meaning of each of these. So, for simple demo purpose lets get started with one console app demo.

Now, by default it produced me Hello world string. So, when i do F5, it will simply print Hello World on the console screen. Now, if you notice the command console.log which is essentially the same what we use to print messages in javascript console window.

Now, here since i am in visual studio i can get all sort of by default Visual Studio intellisense + since i am using Resharper, so i’ll get pretty mature intellisense to help me through while coding.Also, I can walk through the code and debug the same while running and inspect the values as well as shown in the below screen shot.

Now, i can also run this project using shell as shown below in the screen shot. What i’ll do, i’ll rt-click on the project and then say open command prompt here. Then I’ll use to node to execute my app.js file.

Also, visual studio in background will create the simple project file which is exclusive for node js project as shown in the below screen shot. Now, this is similar to csProj what we used to have whenever we create C# application.

I hope your are enjoying Node learning. In the next module we’ll explore other available templates. Till then stay tuned and Happy coding.

Rahul Sahay
Happy Coding

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