Building a Node.js Web Site on Windows Azure using Node.js Tools for Visual Studio

image

In this blog post, I will take a look at Node.js Tools for Visual Studio and will demonstrate how to build a Node.js web site in Visual Studio and deploy it on Windows Azure by using Node.js Tools for Visual Studio. Microsoft has been released an alpha version of Node.js Tools for Visual Studio which does work with Visual Studio 2012 and Visual Studio 2013. It is really nice that developing Node.js apps on Visual Studio which provides excellent integration with Windows Azure so that we can easily develop Node.js apps with the cool features of Visual Studio and can finally deploy the apps to Windows Azure . I have been using WebStorm for Node.js development, but an IDE with a better integration of Windows Azure is a really an exciting thing for me.

Building Node.js Web Sites in Visual Studio

You can download the Node.js Tools for Visual Studio from its Codeplex site. Let’s create a Node.js web site in Visual Studio. We can see the Node.js project templates from the JavaScript language section. Let’s choose a Blank Windows Azure Express Application which will create a Express.js application and will add a web.config file for Windows Azure web site.

image

The Express.js project will ask for run npm install to get the dependencies specified in package.json.

image

Let’s choose “Yes” to run npm install to get the dependencies.  

image

This will install the npm modules specified in the package.json, which can see from the folder npm in the Visual Studio project.

image

Another cool feature of Node.js Tools for Visual Studio, is that it you can install npm modules from Visual Studio itself. Just right click on the folder npm and click “Manage npm Module”, it will show npm Package Management window as shown in the below figure. 

image

Node.js Tools for Visual Studio lets Node.js developers better debugging experience in Visual Studio. You can put breakpoints and can debug your node.js apps in Visual Studio.

image

Another cool feature of Node.js Tools for Visual Studio, is the Node.js profiler which can be used for profiling your Node.js apps. The profiler can run from selecting “Launch Node.js profiling” from the “Analyse” menu of Visual Studio. The figure below shows that a sample profiling report after running the app with profiler tool.

image

We just went through some cool features of Node.js Tools for Visual Studio. Lot of other goodies are there with Node.js integration in Visual Studio. If you are building Node.js apps on Windows Azure, you can easily deploy the apps to Windows Azure by using the better IDE integration with Windows Azure. Let’s deploy the Node.js app to Windows Azure from publish option of Visual Studio.

image

We have deployed our Node.js web site to Windows Azure web site from Visual Stuio. The figure below shows that our Node.js web site is running in Windows Azure.

image

You can follow me on Twitter @shijucv

No Comments