Node.js Tools For Visual Studio

NodeJsInVisualStudioProjectListSeveral weeks ago now, I started learning Node.js.  Why?  Well, for a couple of reasons.  First, all the cool kids are using Node.js.  Second, I wanted to use Istanbul to get an idea of how well my javascript code is covered by test and that runs under Node.js.  Third, Node.js is going to show up in the next version of Visual Studio.  And finally, I just like to learn new stuff.

Node.JS

So, I started by installing node and just working in Visual Studio as though my node project was a web site.  It works, but it isn’t pretty.  But it did get me familiar with some basic concepts like using the node package manager (npm) to install what I needed to get Istanbul running.  For those of you who aren’t familiar with npm, it is basically NuGet for node.js.

Istanbul JavaScript Code Coverage

For those of you who are interested, I used the instructions here for getting Istanbul working locally.  They should probably be updated because the example there doesn’t have a good configuration example.  I filled in the rest of what I needed to know from the Karma site.

Node for Visual Studio

So then I had heard that work was being done on a plugin for Visual Studio 2013 that would allow me to work on Node projects from within Visual Studio.  I found out about this first from Scott Hanselman’s blog.

So I went  to the plugin site and got the download and installed it.  This is all pretty straight forward.  Don’t forget, you’ll ALSO need to install node.  So, don’t forget that step.

OK.  Now that you have the NTVS installed (that’s what they call the plugin) what do you have?

Well, you have several new project templates that you can use.  That’s what.

NodeJsInVisualStudioProjectList

Interactive JavaScript

But that’s not all you get, you also get an interactive Node.js window that you can get to from the Tools menu (Tools –> Node.js Tools –> Node.js Interactive window) or by pressing  the keyboard shortcut, Ctrl+K, N.  Inside this window you can execute JavaScript on the fly:

NodeJsInteractiveWindow

Node Package Manager in Visual Studio

Or install other node packages:

.npm install yourPackageNameHere

Don’t forget the leading period.  That’s the indication to the window that it needs to do something different than executing javascript in the window.

Even as I’m writing this, I’m seeing that there is a whole lot more here than I’m actually telling you now.

Starting a New Project

Now, the best way of learning something is by creating some kind of product.  Even if it is for your own use.  So, the next thing I did was to try to create a project.  I have a specific project in mind that should use MongoDB for the database (I’ve been meaning to learn NoSQL for a while now) and since Express seems to come with NTVS, I guess I’ll use that for my web server.  Oh and Angular for the front end.

Since I was creating a web site, I thought, I should create a new web project that uses node.  In fact, it shows up  in the list of web sites types that you can create.  However, I got an error when I did that, and I don’t see anything in the documentation that says I should be able to use those templates or that I need anything extra to use them.

However, if you use the project options, you can create a web application.  I decided going with newer is better than older, so I’ve created a “Basic Node.js Express 4 Application”.

The Fun Is Just Beginning

And now, this is where the fun begins.  Where’s my HTML?  What’s all this “template” stuff?  And how do I install Angular?  Or do I do that manually since it isn’t a server side thing?

So much to learn.  But, that’s for another post.

Other places talking about Node.JS Tools For Visual Studio

 

Other post in Node.js
Summary
Article Name
Node.js Tools For Visual Studio
Author
Description
This is a short description of my experience using Visual Studio to write Node.js code.

Like this Article? Subscribe to get every article sent to your email.

Related Post

  • Selenium Grid SetupSelenium Grid Setup My experience with setting up Selenium Grid was frustrated by the lack of information available about exactly what I needed to do to get this working.I’ve actually had this working for […]
  • DotNetNuke Modules – Creating Base ModulesDotNetNuke Modules – Creating Base Modules Now that we have DotNetNuke installed into Visual Studio we can go ahead and create our first modules. Actually, creating the modules is pretty simple. But it is even easier to do it […]
  • Getting started with jQuery and ASP.NETGetting started with jQuery and ASP.NET As promised, I am starting a series on jQuery.  Today our goal is to get a project setup in Visual Studio that uses jQuery.  We won't be explaining much in the way of syntax, but we will […]
  • Is JavaScript Broken?Is JavaScript Broken? I read a post this week that was essentially a rant on the way JavaScript handles concatenation.  It states that JavaScript is in someway “broken” (without actually using that word) […]
  • JavaScript Performance TweaksJavaScript Performance Tweaks So, I started reading High Performance JavaScript recently and I thought now might be a good time to give a summary of what I've learned so far.Up until recently, I wasn’t all that […]

About Dave Bush

Dave Bush is a Full Stack ASP.NET developer. His commitment to quality through test driven development, vast knowledge of C#, HTML, CSS and JavaScript as well as his ability to mentor younger programmers and his passion for Agile/Scrum as defined by the Agile Manifesto and the Scrum Alliance will certainly be an asset to your organization.

One Pingback/Trackback

    13 April 2015 at 3:04am
    […] Tools Guy How to Convert an SQL Server Data into JSON ...
  • Automate the Planet
  • http://www.mayofcherries.com Kris K.

    Cool, looking forward to hearing some more Node.js adventures. I really like the whole Node.js idea, but never had time to really get into it.
    Have you heard of io.js? What do you think about it and the future of Node.js?

    • http://blog.dmbcllc.com/ Dave Bush

      I’ve heard of io.js. Since it is based on Node.js, if it ever gains steam, I think learning node will port to io. Since right now Node is what seems to be in demand, that’s what I’m focusing on.

  • Pingback: Automate the Planet