Taking Baby Steps with Node.js – Introduction
Like myself, you might have read an article somewhere about Node.js or heard it mentioned a couple of times during some talk. So I actually got curious and decided to start learning more about it.
There seem to be similar frameworks like Node.js on other development platforms as well like Twisted (Python), Jetty (Java) and EventMachine (Ruby). Node.js only runs on Mac OS X and other Unix-based systems like Linux. Windows is currently not supported, but you can work around this by installing Cygwin. If you don?t care about firing up Linux on a virtual machine, then you can follow the steps laid out by Matthew Podwysocki in his blog post on how to get started with Node.js on Windows.
There?s one thing that I feel is missing from Matthew?s post that I urge you to install as well. It?s a small tool called Npm. Npm is a package manager for installing non-standard modules for Node.js. Node.js already comes with a number of built-in modules for accessing the network or the file system, but there are a whole slew of other modules on GitHub or the Npm repository. The vast amount of open-source modules clearly proves that the Node.js community is a vibrant one and that they?ve been very busy providing more capabilities to the platform.
In order to install Npm, you first need to enable curl in Cygwin. If you already installed Cygwin and forgot to install this package, don?t worry. Just run the Cygwin installer again and select the required package. The packages you selected in a previous install will not be removed unless you explicitly unselect them from the list.
Now to install Npm simply execute the following command:
curl http://npmjs.org/install.sh | sh
There you go. Now you?re able to install as many open-source modules for Node.js as you like. The first one I?ve installed is a web development framework called Express. Getting this module is as simple as executing the following command:
$ npm install express
That?s it. As I mentioned earlier, I?m still figuring out this stuff myself. I?m more than happy to get some feedback and hear you thoughts about Node.js. I?ll probably be writing a couple of more blog posts about Node.js in the future as I learn more along the way.