Class: server

backend.server()

new server()

Server abstration object
Source:

Members

(static) app :object

Express init object
Type:
  • object
Source:

(static) port :number

Port to use. Defaults to a "PORT" env variable if set (For heroku and other deployment methods), otherwise uses the port set in the config file. Defaults to 8080.
Type:
  • number
Source:

Methods

(static) init()

Basic express setup. Sets JSON encoding, url encoded bodies and static routing. Should be run prior to any routing.
Source:

(static) route(path, function, method)

Creates a promise based express route. This abstraction makes repetitive routing more robust. Handles errors by default.
Parameters:
Name Type Description
path string URI to listen for
function function A function which should return a promise to evaluate. The resolution value will be sent to the client with 200. Errors will be sent with 409.
method string Routing method. Defaults to GET.
Source:

(static) start()

Starts the webserver. This method should be run last, after init and routing.
Source: