AppUnit

libflitter/app/AppUnit~ AppUnit

The app unit is the final unit in the stack, and makes the final call to the Express HTTP server. As such, it is the innermost context which the Flitter application can access. No other units after this will show up to the Flitter components as being started.


Constructor

new AppUnit()

Extends

Members

(static) name

Defines the name of the service provided by this unit: 'http'

(static) services

Defines the services required by this unit.

(private) _di_allow_defer :boolean

If true, the injector will defer the class if the class requests any services that the container is missing. These services are filled in later and added to the prototype and any instances. True by default.

Type:
  • boolean

(private) _di_deferred_instances :Array.<module:flitter-di/src/Injectable~Injectable>

Collection of instances of this class that need to have the deferred service instances injected into them when the deferred services are finally provided.

(private) _di_deferred_services :Array.<string>

List of services that were deferred and not provided at the time of injection.

Type:
  • Array.<string>

Methods

(async) cleanup(app) → {Promise.<void>}

Clean up the unit resources. Closes the Express HTTP(S) server.

Parameters:
Name Type Description
app module:libflitter/app/FlitterApp~FlitterApp
Returns:
Type
Promise.<void>

directories() → {Object}

Get the directories provided by the unit. Should be an object such that key => value is the name of the directory => fully qualified path to the directory.

Returns:
Type
Object

(async) go(app) → {Promise.<void>}

Loads the unit. Launches the HTTP server.

Parameters:
Name Type Description
app module:libflitter/app/FlitterApp~FlitterApp

the Flitter app

Returns:
Type
Promise.<void>

name() → {String}

Get the name of the unit. Should be a lowercase, alphanum/dash/underscore string.

Returns:
Type
String

serve_express(app) → {Promise.<any>}

Launch an HTTP server from the underlying Express app on the port configured by the config value "server.port".

Parameters:
Name Type Description
app module:libflitter/app/FlitterApp~FlitterApp

the Flitter app to be served

Returns:
Type
Promise.<any>

status(setopt) → {string}

Get or set the unit's current status.

Parameters:
Name Type Attributes Description
set string <optional>

if provided, set the status of the unit

Returns:
  • current status of the unit
Type
string