You are here:
< Back

NodeJS – High Level Overview

 

The NodeJS engine is running on your server behind our other services. It is published and anyone with the link can access it.

Using our template package

Our template package contains:

  • Instagram, Facebook, Feedly connectors
  • Instagram, Facebook, Feedly widgets
  • Serving static files
  • Database connector sample

You can find more information here.

Creating your own application

If you want to create your own NodeJs application there is a few things you need to be aware of.

Your main NodeJs application file must be named index.js
Also your package.json should start and watch your application in these formats:

“start”: “node index”,
“watch”: “node index”

We have environment variables set up that you can reach with process.env.{variable} inside your NodeJs script.

Such variables are:

  • URL = The base URL where you can reach your NodeJs application
  • PORT = The port where your NodeJs application runs.
  • DEBUG= ‘*‘ indicates whether your application is running in debug mode or not.

 

Uploading your application to your server

Copy your files to the /srv/docker/nodejs/localscripts folder on your server.

The service will automatically create the node_modules folder and the package-lock.json file if you have the dependencies set up in your package.json file, so there is no need to copy them.
The NodeJs environment automatically restarts when it detects changes in a file.

 

How to reach your endpoints

If your server has a domain and a valid certificate:
https://{yourdomain}/localscripts/{yourendpoint}

If you have a local server without domain:
http://{yourServer’sIpAddress}:{port}/{yourendpoint}