we write about the things we build and the things we consume
Node can serve static files, connect to other servers and get data from databases, just like many other languages, however the NPM (Node Package Manager) makes the whole process a lot easier. NPM is a repository of user submitted packages that can easily be included in your Node project. Some packages provide simplified wrappers, others provide specific interfaces for APIs but they all increase the speed at which you can get something up and running, especially considering most only require 'npm install [package]' to be typed into your CLI before they're ready for use.
I can't bring up packages without mentioning the package that made me try Node in the first place—Socket.io is a web socket wrapper that allows you to transfer data through web sockets, or alternative fallbacks for older browsers. We use Socket.io in nearly every project now, as it allows us to make our prototypes a lot more user friendly, giving immediate feedback to interactions and streaming such things as federated search results, as we receive them.
I've recently been working on an Internal Dashboard in Node, showing various statistics in the office. Originally browser based, our dashboard made multiple AJAX API calls to various services like Jira, Git and Twitter, which unsurprisingly was slow. The 'adapters' for these services were written modularly, so when we decided Node would be a better choice, I could copy the modules over with minimum alteration. Much time was saved!
more than just your local web server
Installation locally is a straightforward affair for the most part. If you're on OSX or Windows you get a handy little installer. Linux users should check their package managers. If you can't find a prebuilt package, I'm afraid you're going to have to build it yourself. We use Debian on our production boxes, which doesn't have the latest version prebuilt, so Adam valiantly maintains a build on our AWS backed repository.
Luckily the most recent versions of Node come with NPM built-in. Gone are the days of building both Node and NPM separately.
what works well for us & what doesn't
We'll be writing about Node again, as we use it more and it develops further, documenting things we've learnt and use cases at MetaBroadcast. What do you think of Node? What are the alternatives? We're always looking to try new languages and widen our tool belts.Download as PDF