How to deploy a NodeJs application

1 de noviembre, 2015 @ 13:06 — 0 comentariosDownload PDF

In this guide we explain how to deploy an existing or a new empty NodeJS application on our hosting services.

Before following this guide you should Configure your environment for woking with NodeJS.

1 - Define the app from the Hosting Panel

1 - Access your Hosting Panel

Just follow instruccions of How to access your Hosting Panel.

2 - Click on NodeJS Applications

Look for and click on NodeJS Applications icon.


3 - Define the app

Fill in the form and click on large Send button.


Once you submit the form you we'll see the app creation result. Take note of the application directory as it's important for the next steps.


2 - Upload application files

You must upload application files and move them to the application directory. The application directory is the application's root folder, for example: if the app name is mynode, the application directory will be /home/username/nodejs/mynode.

Take into account that in order to function a NodeJS application must respect the following basic structure:

 |_____ app.js
 |_____ public
 |_____ tmp

We recommend you to read the Basic structure of a NodeJS application guide.

3 - Install dependencies with NPM

This step is necesarily done from the command line so you have to access your hosting using SSH. Once logged, move to the application's root folder:

cd nodejs/mymode

If your application has a package.json file with all dependencies, simply run:

npm install --production

This command installs on the node_modules application's folder all packages defined in the package.json file.

In the other hand, if you application does not haver a package.json file, you will have to manually install all dependencies one by one:

npm install [package name]

We recommend you to read the oficial docs about package.json and npm install command.