logo-node-js-whiteBack in 2008, I started a series of articles on Networking basics titled the "Networking ABC’s" in which I set out to document a networking Term for each letter of the alphabet.  After some good feedback, I followed that up with The "Social Media ABC’s" and then the "PowerShell ABC’s".

After a hiatus on my ABC series, I decided to start it back up again, this time focusing on the up and coming development language Node.js.  With F5's release of the Linerate Application Proxy earlier this year, F5 officially added Node.js to it's portfolio of application APIs.  For those new to Node.js, this series aims to take 26 of the basic terms or concepts and hopefully give you some insight into how they support the language and runtime.

For the first article in this series I'm going to try to explain what Node.js is.  For that, I'll start with the definition on the Node.js website.

What Is Node.js?

"Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications.  Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices."

Not unlike Java, Python, or PHP, the Node.js runtime can be used to build client and server applications.  Due to it's light footprint, it is also ideal for embedded systems such as F5's Linerate Application Proxy.

Node.js has a base built-in library of standard runtime functions (I/O, environment, etc) and, like Perl's massive public repository of support libraries, Node.js has the same that can be managed with the Node Package Manager.  The online repository for Node.js packages can be found at https://www.npmjs.org/.  With a whopping 104,144 packages that have been contributed by the user community, you will likely find help for any task you want to accomplish.

Getting Up And Running

  1. Download the Node.js runtime from the Downloads section of the Nodejs.org website.  Pre-built packages are available for Windows, OSX, Linux, SunOS.  A source package is available as well if you want to build it yourself.
  2. Install the runtime distribution.  This will provide you with the "node" and "npm" applications.
  3. Open a console window and run the “node” (or “node.exe on windows) command to start the runtime interpreter.
  4. Read-up and run through some intro tutorials.  http://nodeschool.io has some very good introduction materials including the "javascripting", "learnyounode", "git-it", and "stream-adventure" npm packages.  You can use these to learn Node.js directly from within the node runtime.

Your First Node.js Program

For you first timers out there, here’s your typical “Hello World!” program written for node.  I’ll use the Javascript “console.log” command to print output to the console.  The first line echo’s the code into the script called prog.js.  Once the file exists, passing it as a command to the node runtime will cause the script to be executed.


$ echo “console.log(‘Hello World\!’);” > prog.js
$ node prog.js
Hello World!

When you are interested in tackling some more interesting problems, check out the “learnyounode” node package linked to above.  The first few are fairly basic and the last ones can be a bit of a challenge to the intermediate level developer as well.

Be on the lookout for the next article in this series where I talk about Buffers.