Getting started with Node.js development in Visual Studio

Setup Environment on Windows machine for Node.js Development [Set up Sublime Text]

Yes you love node.js. You love event driven development and yes multi thread is old fashioned now. Your new found love is ASYNCHRONOUS. Asynchronous everything, even reading file system. As all we know Microsoft loves Developers. So in Build they decided to give node.js development support in Visual Studio 2012 and Visual Studio 2013.

In this post we will take step by step look on setting up Visual Studio for node.js development. You need to follow below steps,

Step 1

Download in install Node.js from http://nodejs.org/

Step 2

Next download and install Node.js for Visual Studio from here,

https://nodejstools.codeplex.com/releases/view/114437

You need to make sure that you select correct option to download. I am going to install Node on Visual Studio 2012.

image

After successful installation you will get below confirmation message of successful installation.

clip_image001[6]

 

After installation above said pieces you are good to go and start developing Node.js in Visual Studio. On launching Visual Studio in JavaScript language category, you will get various project templates related to Node.js

image

There are five different project templates available.

image

You can create Node.js application web based by selecting, Blank Node.js Web Application project template.

clip_image002

On successful creation of project you will get following files in project. Solution explorer will look like below,

clip_image003

server.js will contain code and entry point of application. By default server.js contains following code

clip_image002[6]

You just need to press F5 to run with debug or Ctrl+F5 to run without debugging. This default code will give you following output in browser

clip_image003[7]

And whereas debugger is listening on port 5858.

image

So we experienced that working with Node.js in Visual Studio is very smooth. You just need to press F5 to run application and can put a breakpoint and debug the code. As you see in below image that breakpoint is being hit.

image

You can find that intellisense will work as expected. This completely support intellisense for Node.js

image

Other thing you will notice that Node.js debugger support complete stack trace.

 

clip_image002[8]

 

Exporting existing Node.js project

You can create existing Node.js project from existing Node.js project by creating a project choosing template From Existing Node.js code

clip_image002[10]

On next screen you need to browse to existing project folder. You can also select files types to be included. After providing these two input click on Finish.

image

You will find existing project has been exported to new project.

In this way you can set up Visual Studio 2012 to work with Node.js development. I hope you find this post useful. Thanks for reading.

5 responses to “Getting started with Node.js development in Visual Studio”

  1. […] Getting started with Node.js development in Visual Studio (Dhananjay Kumar) […]

  2. […] Getting started with Node.js development in Visual Studio (Dhananjay kumar) – Excellent post to get started with the new node.js feature of Visual Studio. […]

  3. […] Getting started with Node.js development in Visual Studio […]

Leave a comment

Create a website or blog at WordPress.com