Search Free eBooks

Mastering Node by TJ Holowaychuk

Mastering Node by TJ Holowaychuk

Installing Node

In this chapter we will be looking at the installation and compilation of node. Although there are several ways we may install node, we will be looking at homebrew, nDistro, and the most flexible method, of course - compiling from source. Homebrew Homebrew is a package management system for OSX written in Ruby, is extremely well adopted, and easy to use. To install node via the brew executable simply run:

$ brew install node.js

nDistro

nDistro is a distribution toolkit for node, which allows creation and installation of node distros within seconds. An nDistro is simply a dotfile named .ndistro which defines module and node binary version dependencies. In the example below we specify the node binary version 0.1.102, as well as several 3rd party modules.

node 0.1.102
module senchalabs connect
module visionmedia express 1.0.0beta2
module visionmedia connect-form
module visionmedia connect-redis
module visionmedia jade
module visionmedia ejs

Globals

As we have learnt, node's module system discourages the use of globals; however node provides a few important globals for use to utilize. The first and most important is the process global, which exposes process manipulation such as signalling, exiting, the process id (pid), and more. Other globals, such as the console object, are provided to those used to writing JavaScript for web browsers.

Events

The concept of an "event" is crucial to node, and is used heavily throughout core

Read book online on Google Docs Mastering Node by TJ Holowaychuk

No comments:

Post a Comment