Getting Started with Node.js: Installation and Resources

node.js is a server side Javascript framework built on top of Google's V8 Javascript Engine, aiming to help developers in building highly scalable and concurrent network applications, by using purely evented non-blocking I/O.

In short - node.js is a server side Javascript framework built on top of Google's V8 Javascript Engine, aiming to help developers in building highly scalable and concurrent network applications, by using purely evented non-blocking I/O (similar to EventMachine or Twisted), written in 8,000 lines of C/C++ and 2,000 lines of Javascript. Oh yeah.

Slightly extended and more descriptive version of this can be found on node.js About page.

Main design goals of node.js:

  • No function should direct perform I/O.
  • To receive info from disk, network, or another process there must be a callback.
  • Low-level.
  • Stream everything; never force the buffering of data.
  • Do not remove functionality present at the POSIX layer. For example, support half-closed TCP connections.
  • Have built-in support for the most important protocols: TCP, DNS, HTTP
  • Support many HTTP features: chunked requests and responses, keep-alive, hang requests for comet applications.
  • The API should be both familiar to client-side JS programmers and old school UNIX hackers.
  • Be platform independent.

A very good (and really helpful in terms of grasping its concepts) overview of the idea behind node.js, what it is and how it works, together with several usage examples, is available in node.js' author Ryan Dahl's presentation given during JSConf 2010.

Installation

To install node.js on your Linux machine simply execute the following commands:

git clone git://github.com/ry/node.git
cd node
./configure
make
sudo make install

Instead of using git, node.js can be downloaded directly from its home page.

For building the system no dependencies other than Python are required, and V8 engine is already included in the distribution.

Examples

Basic usage examples can be found on node.js home page ("Hello world" web server and "echoing" TCP server).

There is also a chat room running at chat.nodejs.org (based on long-polling) with source available at http://github.com/ry/node_chat, and lots of other examples in documentation.

And, obviously, even more over the whole Internet. Google to the rescue!

Basic Resources