Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

This branch is 664 commits behind 4_9_x

Fetching latest commit…

Cannot retrieve the latest commit at this time

..
Failed to load latest commit information.
fonts
lib
oauth2
routes
scripts
stomps
views
xt
.gitignore
.gitmodules
main.js
readme.md
replsed.sh
sample_config.js

readme.md

Datasource

A Node.js web service designed for deployment in a cloud environment and one piece of the Postbooks cloud technology stack. Exposes both a REST and WebSocket API for clients, serves the client and authentication source, manages user authentication, communication with the postgres databases, session control and more.

All of the configuration options for the datasource are in the config.js file (modified by you) or in any other configuration file and specified by the -c flag from the command-line at command invocation. You will typically want to copy the sample_config.js file to config.js and update any fields that are specific to your implementation.

// from config.js
datasource: {
  sessionTimeout: 15,
  securePort: 443,
  secureKeyFile: "./lib/private/key.pem",
  secureCertFile: "./lib/private/cert.crt",
  secureSaltFile: "./lib/private/salt.txt"
}

The datasource now needs a private key and signed certificate to be able to provide SSL (https) encryption. It is beyond the scope of these instructions to direct on how to generate a self-signed certificate for development. Note that once these have been generated they, by convention, should be placed in the lib/private directory but can be placed anywhere in the project directory with their paths specified in the config.js file.

The files that need to be generated/modified as necessary are:

  • config.js for configuring the datasource
  • lib/private/key.pem (or other path/name as specified by you)
  • lib/private/cert.crt (or other path/name as specified by you)
  • lib/private/salt.txt (or other path/name as specified by you)

Hints

  1. The node-datasource uses port 80 and 443; if there is another web server running (e.g. apache) then it needs to be stopped and if this machine is one you would like to frequently run the datasource from you might consider removing apache from an automatic startup routine if it has one. Consult your operating system documentation for details on how to do this. Also note that these ports require elevated credentials to bind thus the sudo in the command for non-root users starting the service.
Something went wrong with that request. Please try again.