ServerModule

server. ServerModule

Adds an Express server to the authoring tool

Constructor

new ServerModule()

Source:

Extends

  • AbstractModule

Members

api :Router

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

expressApp :external:ExpressApp

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

host :String

Source:
Server hostname
Type:
  • String

httpServer :external:HttpServer

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

isListening :Boolean

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

listeningHook :Hook

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

port :String

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

requestHook :Hook

Source:
Hook for interrupting requests
Type:
  • Hook

root :Router

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

url :String

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

Methods

close() → {Promise}

Source:
Stops the Express server
Returns:
Type
Promise

(async) init()

Source:

listen(func) → {Promise}

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

(async) start()

Source:
Starts the HTTP server

static(root, options) → {function}

Source:
See:
Middleware function to allow serving of static files
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