Login for certain variables to be updated with your own slot's information


Node.js is a platform designed for easily creating fast, scalable network applications.

This guide will cover how to install and configure Node.js with n, as well as how to test it with a small and simple HTTP server.

Installation with n

  1. Connect to your slot through SSH

  2. Install n, which also installs the latest stable version of Node.js

     curl -L https://git.io/n-install | bash

    When prompted, type "y" and press Enter to continue installing.

  3. Reload your bash environment by using source ~/.bashrc


To run a file with Node.js, simply do the following:

node <name of file to run>

It is recommended to run it in a screen session so that you can close the SSH connection without Node.js terminating.

Simple HTTP Server Test

To verify that Node.js is working, the following is an easy and simple test that will run a HTTP server on a specified port.

A random port number between 10000 and 65535 is needed and will be used to access the HTTP server that we create. The port number 36794 has automatically been generated and will be used throughout this article, but can be changed if needed.

  1. Create the file for this test

     touch test.js
  2. Copy the contents of the box below into the test.js file


var http = require("http");
var server = http.createServer(function(request, response) {
    response.write("Hello World!");

console.log("Server is listening");
  1. Start the HTTP server with the following command

     node test.js

If you navigate your browser to http://server.whatbox.ca:36794/, you should see "Hello World!".

Further Learning

API documentation can be found on their official website at https://nodejs.org/api.

If you are just starting out with Node.js (or Javascript in general), http://nodeschool.io/#workshopper-list provide great hands-on tutorials (NOTE: They require Node.js to be installed on the machine before you begin).