My First Impressions of node.js

Over the holiday season, I thought it might be fun to try the node.js on azure walkthrough here. Up until recently I never even heard of node.js, but lately it’s been all the rage so I figure I owe it to myself (and my customers) to be up to date with it. So here we go. First off, what is node.js? The quick answer to that is its server-side JavaScript. With all the JQuery, and Ajax going on, it seems like the next logical step is to push JavaScript onto the server and stick with one language. If you’re feeling a little squeamish after reading that, then you’re not alone. There are so many servers out there, why do you need another one?

Well, one of the cool things about node.js is that it is the smallest looking server I’ve basically ever worked with. Smaller then Apache. In a few lines of code you have your entire webserver there ready to accept requests. That part is nice and powerful. If you want a longer explanation  of node.js itself there are some here, and here. Seriously, read those explanations. 

Granted, I may not have really given it a good honest try, but i  can already tell I don't really like it. I expected at first i would just be able to write an HTML and javascript/Ajax page and then just ask node to host it, adding in server side code to go with the Ajax. But noooo, apparently you need to design the pages in something called Jade, and then have something called Express translate the pages. Now it reminds me of Ruby or Grails. I'm sure there are other interpreters then Jade/Express, but I have a feeling it's going to be another thing i have to learn anyway. I guess that's my biggest gripe so far.

Troubleshooting is the other issue I have with node.js. As i was going through the examples from the node on azure walkthrough, and on the node.js website, I would occasionally make some silly mistake. Maybe i didn't close a paren, or mixed some capitalization, but in either case the only error I would get is a page telling me there was a 500 error. I had no idea where the problem was. The js? My jade/express? Was a file in the wrong folder? No idea, i just had to comment things out until things worked again and then slowly get the new changes working. Hugely annoying. Some sort of message would be nice. I realize the language isn't compiled, but still.

With those things, I have a hard time finding a good reason to use node.js. Especially with the learning curve. I'll find a reason though! Sometimes when you have a hammer like this, you need to find a nail. :)

Part of the reason I wanted to learn some node.js was because Microsoft made it easy to put onto Azure, which is handy and a load of fun! All of the tooling to get settings, create the necessary files, and publish your project is all done through Powershell. Notepad and the command line is all you need. Like I mentioned already though, I have mixed emotions doing it this way.

The benefit to having node.js on Azure, is its lightweight, and you'll probably be able to do more with a smaller VM size - saving you some money. Also it was actually pretty simple to get a full node.js solution up and running on Azure. I don't know if it's going to be much easier to get it going on a stand alone server. Plus once your traffic grows, and you need more power, all you'll need to do is either increase the size of your instance, or increase the amount of instances. No additional configuration will be needed. That's going to be a whole lot nicer then your typical on premise server and you have to migrate it onto a bigger server later.

Don't let my lackluster review of node.js prevent you from trying it out yourself. Its a popular framework right now and it may solve a problem you have. In fact if it IS solving a problem you have, let me know in the comments, I'd be excited to hear about it.