Node.js

Node.js is a popular Javascript runtime that can power web applications. Opalstack provides a simple installer that creates a very basic Node.js web application.

Installation

To install a NodeJS application follow our general instructions for adding applications and select "NodeJS" as the application type in step 5.

When the installation is complete, the following files and directories will be present in the application directory:

  • start and stop scripts to control the operation of your application.
  • tmp: a directory containing temporary files used by your application
  • app.js: a basic Node.js "Hello World" web application
  • README: basic info regarding the new application.

Complete the setup by adding the application to a site.

Installing Node packages with npm

You can install additional Javascript packages for your Node.js applications as follows:

  1. Log in to your shell user account via SSH.

  2. Switch to your application directory and install the package by running the commands in the example below, replacing myapp with the name of your Node.js application and packagename with the name of the package that you want to install:

    cd ~/apps/myapp
    export PATH=$PWD/node/bin:$PATH
    npm install packagename