WebserverService

WebserverService

The Twyr Web Application Server Webserver Service - based on Koa.

Constructor

new WebserverService()

Allows the rest of the Twyr Modules to expose REST API.

Source:

Allows the rest of the Twyr Modules to expose REST API.

Extends

Members

(readonly) basePath :string

Source:
Overrides:
Type:
  • string

(readonly) dependencies :Object

Source:
Overrides:
Type:
  • Object

(readonly) Interface :Object

Source:
Overrides:
Type:
  • Object

(readonly) name :string

Source:
Inherited From:
Type:
  • string

Methods

(async) _auditLog(ctxt, next) → {undefined}

Pushes the data from the request/response cycle to the Audit Service for publication.

Source:
Parameters:
Name Type Description
ctxt Object

Koa context.

next callback

Callback to pass the request on to the next route in the chain.

Returns:

Nothing.

Type
undefined

(async) _changeState(newState) → {undefined}

Enables / disables this module, and all its sub-modules (if any).

Source:
Inherited From:
Parameters:
Name Type Description
newState Object

The next state of this module.

Returns:

Nothing.

Type
undefined

(async) _dependencyReconfigure(dependency) → {undefined}

Lets the module know that one of its dependencies changed configuration.

Source:
Inherited From:
Parameters:
Name Type Description
dependency TwyrBaseModule

The dependency that changed configuration.

Returns:

Nothing.

Type
undefined

(async) _dependencyStateChange(dependency, newState) → {undefined}

Lets the module know that one of its dependencies changed state.

Source:
Inherited From:
Parameters:
Name Type Description
dependency TwyrBaseModule

The dependency that changed state.

newState Object

The next state of the dependency.

Returns:

Nothing.

Type
undefined

(async) _exists(filepath, mode) → {boolean}

Checks to see if the path can be accessed by this process using the mode specified.

Source:
Inherited From:
Parameters:
Name Type Description
filepath string

Path of the filesystem entity.

mode number

Permission to be checked for.

Returns:

True / False.

Type
boolean

(async) _handleOrProxytoCluster(ctxt, next) → {undefined}

Call Ringpop to decide whether to handle the request, or to forward it someplace else.

Source:
Parameters:
Name Type Description
ctxt Object

Koa context.

next callback

Callback to pass the request on to the next route in the chain.

Returns:

Nothing.

Type
undefined

_handleUncaughtException(err) → {undefined}

Logs Unhandled Exceptions to prevent the process from crashing.

Source:
Inherited From:
Parameters:
Name Type Description
err Error

The unhandled exception.

Returns:

Nothing.

Type
undefined

(async) _parentReconfigure() → {undefined}

Lets the module know that its parent changed configuration.

Source:
Inherited From:
Returns:

Nothing.

Type
undefined

(async) _parentStateChange(newState) → {undefined}

Lets the module know that its parent changed state.

Source:
Inherited From:
Parameters:
Name Type Description
newState Object

The next state of the parent module.

Returns:

Nothing.

Type
undefined

_processRequestFromAnotherNode(request, response) → {undefined}

Returns a function that can handle the request coming in from another Ringpop node.

Source:
Parameters:
Name Type Description
request Object

Request coming in from the outside world.

response Object

Response going out to the outside world.

Returns:

Nothing.

Type
undefined

(async) _reconfigure(newConfig) → {undefined}

Changes the configuration of this module, and informs everyone interested.

Source:
Overrides:
Parameters:
Name Type Description
newConfig Object

The changed confoguration.

Returns:

Nothing.

Type
undefined

(async) _serveTenantFavicon(ctxt, next) → {undefined}

Return the favicon set by the tenant.

Source:
Parameters:
Name Type Description
ctxt Object

Koa context.

next callback

Callback to pass the request on to the next route in the chain.

Returns:

Nothing.

Type
undefined

(async) _serveTenantStaticAssets(ctxt, next) → {undefined}

Serve up the static assets from the current tenants folder.

Source:
Parameters:
Name Type Description
ctxt Object

Koa context.

next callback

Callback to pass the request on to the next route in the chain.

Returns:

Nothing.

Type
undefined

(async) _setTenant(ctxt, next) → {undefined}

Sets up the tenant context on each request so Ringpop knows which node in the cluster to route it to.

Source:
Parameters:
Name Type Description
ctxt Object

Koa context.

next callback

Callback to pass the request on to the next route in the chain.

Returns:

Nothing.

Type
undefined

(async) _setup() → {undefined}

To be implemented by derived classes for setting themselves up.

Source:
Overrides:
Returns:

Nothing.

Type
undefined

_setupTenantFeatureTree(tenantFeatures, parentModuleId) → {Object}

Returns a sree structure of the features / sub-features that the tenant has access to.

Source:
Parameters:
Name Type Description
tenantFeatures Array

List of features this tenant has access to in the database.

parentModuleId string

Parent Feature to be considered.

Returns:

Tree structure.

Type
Object

(async) _subModuleReconfigure(subModule) → {undefined}

Lets the module know that one of its subModules changed configuration.

Source:
Inherited From:
Parameters:
Name Type Description
subModule TwyrBaseModule

The sub-module that changed configuration.

Returns:

Nothing.

Type
undefined

(async) _subModuleStateChange(subModule, newState) → {undefined}

Lets the module know that one of its subModules changed state.

Source:
Inherited From:
Parameters:
Name Type Description
subModule TwyrBaseModule

The sub-module that changed state.

newState Object

The next state of the sub-module.

Returns:

Nothing.

Type
undefined

(async) _teardown() → {undefined}

To be implemented by derived classes for un-setting themselves down.

Source:
Overrides:
Returns:

Nothing.

Type
undefined

(async) initialize() → {Object}

Initializes sub-modules, if any.

Source:
Inherited From:

Call the loader (typically, TwyrModuleLoader#initialize) to initialize sub-modules, if any.

Returns:
  • The aggregated status returned by sub-modules (if any) once they complete their initialization.
Type
Object

(async) load(configSrvc) → {Object}

Loads sub-modules, if any.

Source:
Inherited From:
  1. Use the supplied ConfigurationService instance (if any), to get / store both configuration and state.
  2. Call the loader (typically, TwyrModuleLoader#load) to load sub-modules, if any.
Parameters:
Name Type Description
configSrvc ConfigurationService

Instance of the ConfigurationService that supplies configuration.

Returns:
  • The aggregated status returned by sub-modules (if any) once they complete their loading.
Type
Object

(async) start(dependencies) → {Object}

Starts sub-modules, if any.

Source:
Inherited From:

Call the loader (typically, TwyrModuleLoader#start) to start sub-modules, if any.

Parameters:
Name Type Description
dependencies Object

Interfaces to TwyrBaseService instances that this module depends on.

Returns:
  • The aggregated status returned by sub-modules (if any) once they complete their startup sequences.
Type
Object

(async) stop() → {Object}

Stops sub-modules, if any.

Source:
Inherited From:

Call the loader (typically, TwyrModuleLoader#stop) to shutdown sub-modules, if any.

Returns:
  • The aggregated status returned by sub-modules (if any) once they complete their shutdown sequences.
Type
Object

(async) uninitialize() → {Object}

Uninitializes sub-modules, if any.

Source:
Inherited From:

Call the loader (typically, TwyrModuleLoader#uninitialize) to uninitialize sub-modules, if any.

Returns:
  • The aggregated status returned by sub-modules (if any) once they uninitialize themselves.
Type
Object

(async) unload() → {Object}

Unloads sub-modules, if any.

Source:
Inherited From:

Call the loader (typically, TwyrModuleLoader#unload) to unload sub-modules, if any.

Returns:
  • The aggregated status returned by sub-modules (if any) once they unload themselves.
Type
Object