ServerModule

server. ServerModule

Adds an Express server to the authoring tool

Constructor

new ServerModule()

Source:

Extends

  • AbstractModule

Members

api :Router

Description:
  • The router which handles all APIs
Source:
The router which handles all APIs
Type:
  • Router

expressApp :external:ExpressApp

Description:
  • The main Express Application
Source:
The main Express Application
Type:
  • external:ExpressApp

host :String

Description:
  • Server hostname
Source:
Server hostname
Type:
  • String

httpServer :external:HttpServer

Description:
  • Reference to the HTTP server used by Express
Source:
Reference to the HTTP server used by Express
Type:
  • external:HttpServer

isListening :Boolean

Description:
  • Whether the HTTP server is listening for requests
Source:
Whether the HTTP server is listening for requests
Type:
  • Boolean

listeningHook :Hook

Description:
  • Hook invoked when the HTTP server is listening
Source:
Hook invoked when the HTTP server is listening
Type:
  • Hook

port :String

Description:
  • Port the app should listen on
Source:
Port the app should listen on
Type:
  • String

requestHook :Hook

Description:
  • Hook for interrupting requests
Source:
Hook for interrupting requests
Type:
  • Hook

root :Router

Description:
  • The default/'root' router for the application
Source:
The default/'root' router for the application
Type:
  • Router

url :String

Description:
  • The URL for the server from its config
Source:
The URL for the server from its config
Type:
  • String

Methods

close() → {Promise}

Description:
  • Stops the Express server
Source:
Returns:
Type
Promise

(async) init()

Source:

listen(func) → {Promise}

Description:
  • Start the Express server (shortcut to the Express function of the same name).
Source:
See:
Parameters:
Name Type Description
func function Callback function to be called on connection.
Returns:
Resolves with the server instance
Type
Promise

(async) start()

Description:
  • Starts the HTTP server
Source:

static(root, options) → {function}

Description:
  • Middleware function to allow serving of static files
Source:
See:
Parameters:
Name Type Description
root String The root directory from which to serve static assets
options Object Options to pass to the function
Returns:
Type
function