Sunday, July 10, 2016

Node.js - First Impressions

Well, I like this node.js.  I've done a small number of interesting project, and they came together faster than if I were going to do them in Java.  The learning curve is pretty easy, simpler than JEE.  I don't think that's a fair comparison though. And things run as soon as you finish typing, so there's no painful compile and packaging and deployment phase.

I haven't done much with it.  I wrote a drone controller with some simple MQTT, some REST calls, some AJAX handers, a tiny web app.  Enough that I think this is worth investing more time in.  I've dabbled in Node-Red, which is a kind of visual node.js, although they tell you it's really for connecting things.  Maybe that's it's sweet spot.

The only down side I see to node.js on Windows is that getting anything more complicated than what I've already done to work on a Windows machine requires some version of the Microsoft Visual C++ compiler in order for one of the modules, called gyp, to work.  StackOverflow is loaded with posts from people who simply could not get it working.  And I'm no better.  I've tried just about everything to get gyp to work, including several days of downloading and installing multiple gigabytes worth various versions of Visual Studio.  I'm beginning to think node.js might be the thing that turns me into a Linux guy.

Node-Red is a nice visual tool for stringing together node.js modules.  And if you stick to the prewritten nodes you're fine.  If you need to start writing your own Node-Red nodes, then give it some thought.  Maybe you're better off in node.js.  I quickly tested the limits of Node-Red when I wanted to implement a callback, which is a trivial thing in node.js

---
Followup:  What I had to do was
 1) Install Visual Studio C++ Community Edition
 2) npm config set msvs_version 2015
 3) npm -g install npm@next

I think that's all I did, and now it seems fine.

No comments:

Post a Comment