Node.js er what’s it supposed to be used for?

<Disclaimer I am new to Node.js so this represents my current thoughts and additionally much of my development is on a Microsoft platform so I come from this perspective>

There is a lot of fuss in the web development community at the moment about Node.js and how it’s going to be the next big thing.

Node.js provides an environment to run JavaScript in and has been used successfully on a number of high traffic sites such as LinkedIn so I decided to investigate further. Now I really like JavaScript (although it has both the irritation and bonus that I discover something new about it every week) so I was keen to look into this technology and what I could potentially use it for.

The main arguments I have heard for using Node are:

  • It’s great for service type stuff as it’s more scalable because of its eventing model, no locks etc
  • A JavaScript runtime environment outside the web browser

Superior Scalability

One of the biggest claims you will hear from Node advocates is its superior scalability due to its use of call-backs (async) and no locking. The jury seems to be out on whether Node applications do actually scale better than other alternatives and there are countless blog posts arguing both ways. I don’t know enough about the low level detail to argue either way but let’s assume it’s pretty quick for certain scenarios (basically anything that’s IO bound is a potential candidate).

It’s important to also note that you can develop a similar scalable async model with .net although it certainly wasn’t as easy or intuitive as Node.js (especially without C#5’s Async features).

One thing I will say however in that my consultancy experience it is rarely the technology that is at fault when it comes to performance and let’s face it most of us don’t need our applications to be as scalable as something like LinkedIn or Facebook. More often than not performance issues are due to many calls being made to a database (usually multiple times) and the returning unnecessary data so I am not convinced as to this being a good enough reason to try out Node.

A way to run JavaScript outside the web browser

Node.js is pretty cool for playing around with JavaScript providing an environment for running your JavaScript applications and even a RPL interface. I came across an example of this last week when playing with the excellent CSSLint that used Node.js to tell me all the stuff I had screwed up when writing my CSS.

I was however left with the question of why I would actually want to write an application in JavaScript as there are so many existing (and easier?) ways of writing applications. If I want to knock off a quick prog to automate a tedious task or do something similar to CSSLint I am probably going to do it in C# with a mature set of well documented & maintained APIs and Visual Studio’s nice debugging environment. Of course JavaScript’s functional qualities make it very elegant for certain tasks and I can see there might be developers who only know JavaScript who now have another platform to develop on.

The issue however is that the very experienced JavaScript developers tend to have gained this experience from front end work so may not be the sort of people you want developing your services. But I guess its pretty cool that it opens up another option for JavaScript developers.

The second issue that bothered me was due to Node’s immaturity – would it have many libraries for tasks such as querying a database? Well I need not have worried as Node.js has a large community and a number of extensions (node packages) have been developed for performing common tasks so this shouldn’t be that much of an issue. I’m not sure I would trust a community developed interface to a product such as SQL Server to be as mature & up to date as Microsoft’s versions through.

Below are the main advantages I can see Node.js offers


  • Potentially more scalable for certain tasks
  • Developing certain types of services could be more intuitive
  • Node.js servuces are light weight and easy to modify
  • Anything has to be better than WCF (sorry Himanshu but WCF was written by the devil)
  • JavaScript is becoming a universal language & you can potentially run your code on multiple platforms
  • IISNode makes Node.js very easy to setup on Microsoft platform and benefit from IIS features such as logging, connections etc
  • Large number of packages/extensions available
  • Node.js apps can be hosted very cheaply compared to an MS based app e.g. Heroku
  • For the MS devs Node.js can be hosted on Azure (although its apparently a bit of a pain)
  • Could help progress JavaScripts development and standards e.g. common.js


  • How many apps actually need Nodes much touted scalability?
  • When used for Service development the devs that are experienced in writing service type code probably aren’t also those experienced in JavaScript (not always of course!)
  • How can a wrapper for something like SQL server be more efficient and feature rich than Microsofts implementations so any perf gains may be negated by usage of poor performing extensions
  • Packages may not be maintained aren’t as mature as traditional vendor options
  • Poor debugging experience (I understand there is a debugger browser extension available)
  • Immature technology – potential bugs and lack of devs skilled in this area
  • Can same “perf/scalability gains” be experienced with existing async functionality?

I’d love to have a really good solid reason to use Node.js but having spoken to a number of colleagues no one is yet to give me one.

Sure its cool but I am left with the question what are you actually going to use it for? Er..

I remain open minded and I’d love for someone to give me a good answer to this question 🙂

Setting up Node on Windows

There is a lot of fuss at the moment in the web development community about a framework called Node.js that allows you to run JavaScript server side. A number of claims about fantastic scalability and lack of locking have been made regarding Node – whether these are actually true and if the advantages outweigh the disadvantages is another question..

Let’s assume however you are a Windows user who wants to see what all the fuss is about and get up and running with Node.js..

Previously getting Node.js running on Windows was a little painful and involved some manual compilation, patching of libaries and an application called Cygwin that emulated a *nix environment.

But no more! getting Node.js running on Windows is now very easy and it can be hosted within IIS by installing IISNode. This is actually pretty important as allows you to take advantage of a number of IIS features thus answering the question of how Node should be managed/hosted on a Windows machine. It’s worth noting as well that Node.js is even supported on Windows Azure.

Below are instructions on how to install Node.js on Windows:

First you are going to need a Windows OS that is at least as new as Vista with the IIS URL Rewriter module installed (add/remove programs).

If this is all good then go download & install Node.js from At the time of writing the most recent version is held at:

Next you want to get hold of IIS Node by going to

IIS node has its own installer at (src/setup/iisnode-msi/) run the installer. Once you have run the IIS node installer if you look under the Modules section in IIS you will see a new module has been created:

New Node module in IIS

The next step is to create a directory for your node application (note you can also incorporate a node endpoint into an existing application by adding an entry to web.config but let’s keep it simple).

Create a site or application to map through to this directory in IIS (to create an application right click on default website and select Add Application). I am calling my virtual directory AlexNode.

Now create 2 files within your directory:

  • test.js
  • web.config

Open test.js up in a text editor and enter the following hello world node code (this is from the IISNode example):

var http = require(‘http’);

http.createServer(function (req, res) {
res.writeHead(200, {‘Content-Type’: ‘text/html’});
res.end(‘Hello, world! [helloworld sample; iisnode version is ‘
+ process.env.IISNODE_VERSION + ‘, node version is ‘ + process.version + ‘]’);

In web.config enter the following to tell to use the Node module we have just installed:


<add name=”iisnode” path=”test.js” verb=”*” modules=”iisnode” />


That’s it you should now be able to view the node server running on your site by going to an address similar to the following:


My site displays the following text:

Hello, world! [helloworld sample; iisnode version is 0.1.14, node version is v0.6.9]

That’s the set-up basics – there are heaps of extension libraries for Node that you should check out at and IISNode contains several samples that can be installed by going to: %programfiles%\iisnode\setupsamples.bat

Next why would you actually want to do this? 🙂