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.
After successful installation you will get below confirmation message of successful installation.
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
There are five different project templates available.
You can create Node.js application web based by selecting, Blank Node.js Web Application project template.
On successful creation of project you will get following files in project. Solution explorer will look like below,
server.js will contain code and entry point of application. By default server.js contains following code
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
And whereas debugger is listening on port 5858.
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.
You can find that intellisense will work as expected. This completely support intellisense for Node.js
Other thing you will notice that Node.js debugger support complete stack trace.
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
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.
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.
Leave a Reply