Node.JS API Deployment

NodeJSAPI Plug allows you to create Node.JS API’s with a few click, now it is time to test it on your server.

Here is the tutorial for deploying your Node.JS API to your server.


Fast forward version

  • copy files to web server
  • adjust db credentials if needed
  • sudo npm install
  • node app.js

Long Version

Once you generate an API file, follow these steps to be up and running.

  • Copy Files to Your Web Server
  • UnZip / UnTar Files
  • Install Node Dependencies
  • (optional) Update Database Credentials
  • Run
  • (Advanced) Generate Upstart Script Let's look at each step closely.

Copy Files to Your Webserver

You can use scp, FileZilla or your transfer method of choice. Our NodeJS package have it's own web server so you can copy it anywhere you want.

UnZip / UnTar Files




tar -zxvf yourfile.tar.gz

Install Node Dependencies

We assume you have npm already installed in your system. Simply run sudo npm install to make sure all dependencies are installed.

(Optional) Update Database Credentials

We are big on data privacy, so if you opted to upload your schema, you need to go inside /databases/ and update your credentials


Simply type node app.js to run your code and connect to your API.

(Advanced) Generate Upstart Script

There are many ways to make sure that your node instance(s) are up and running. Some developers fancy forever library. We love to generate upstart scripts. (Don't forget to replace [yourapi] part.

sudo vim /etc/init/[yourapi].conf

and type in following script

description "[yourapi]"

start on started mountall
stop on shutdown

respawn limit 99 5

env NODE_ENV=production

exec nodejs [YOUR API PATH]/app.js >> /var/log/[yourapi]-node.log 2>&1

This way you can simply do [yourapi] start and [yourapi] stop to control your api. On plus side, it'll automatically start each time your system reboots.

Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *