Node.js is an open source platform for writing server-side web applications. It is based on an event-oriented and asynchronous programming with non-blocking I/O. The platform is designed to execute standalone web applications in JavaScript. It internally uses the Google V8 JavaScript engine to execute code.
Node.js can be integrated with Drupal 7, using the module Node.js integration. Let's try it in action, and at the end we will see whether node.js works correctly with this module.
First, you should install all the necessary packages for work with node.js and node.js itself:
$ sudo apt-get install build-essential git curl openssl libssl-dev
The most common method of installing node.js is to compile it from the source codes.
Note: you should replace v.0.8.x with the latest stable version from https://github.com/nodejs/node-v0.x-archive
$ mkdir -p ~/local/src
cd ~/local/src
git clone --branch v0.8.x git://github.com/joyent/node.git
cd node
./configure
make
sudo make install
If there were no errors in the installation process, the node.js will be available for you. For example:
$ node
> console.log('Hello world');
Hello world
Our next step is to install the module node.js on Drupal. Then you should enter the directory with this module, using the following command:
$ cd path/to/your/nodejs/module/directory
Next the web developer should install all the required dependencies:
$ sudo npm install
$ sudo npm install socket.io
$ sudo npm install request
$ sudo npm install express
$ sudo npm install connect