Server

Server

Server

Constructor

new Server()

Source:

Methods

actuators(io)

PM2 managed function

Parameters:
Name Type Description
io *

PM2 managed argument

Source:
Example
pm2 trigger <app_id> process

bindProcess()

bind the process to SIGINT, SIGQUIT, SIGTERM, unhandledRejection, uncaughtException, beforeExit, and exit program POSIX signal events to assist with safe shutdown

Source:

expressInitialize()

Initialize express middleware and hook the middleware

Source:

hookRoute(item) → {*}

hookRoute

Parameters:
Name Type Description
item object

item from the api config

Source:
Returns:
  • returns item with required execution function
Type
*

(async) initialize() → {Server}

Hook process variables uncaughtException, unhandledRejection, and exit to handle any potential errors that may occur. This will allow us to properly handle exit and log all non-V8 level errors without the program crashing.

Source:
Returns:
  • this
Type
Server

onStart(cb)

create instance of an http server and start listening on the port

Parameters:
Name Type Description
cb function

pm2 callback

Source:

onStop(err, cb, code, signal)

onStop

Parameters:
Name Type Description
err *

error

cb function

pm2 callback

code number

exit code

signal string

kill signal

Source:

sensors(io)

PM2 managed function

Parameters:
Name Type Description
io *

PM2 managed argument

Source: