Class: App

App

Cli app.


new App()

Mixes In:
Source:
App.js

Extends

Members


config :object

App configuration

Type:
  • object
Inherited From:
Overrides:
Source:
ServiceContainer.js

configLoader :ConfigLoader

Configuration loader instance

Type:
  • ConfigLoader
Inherited From:
Overrides:
Source:
ServiceContainer.js

configName :string

Config basename

Type:
  • string
Inherited From:
Overrides:
Source:
ServiceContainer.js

configPath :string

Config path

Type:
  • string
Inherited From:
Overrides:
Source:
ServiceContainer.js

env :string

Environment flag

Type:
  • string
Inherited From:
Overrides:
Source:
ServiceContainer.js

features :object

Loaded features, name => feature object

Type:
  • object
Inherited From:
Overrides:
Source:
ServiceContainer.js

name :object

Name of the app

Type:
  • object
Inherited From:
Overrides:
Source:
ServiceContainer.js

options :object

App options

Type:
  • object
Inherited From:
Overrides:
Source:
ServiceContainer.js

services :object

Loaded services

Type:
  • object
Inherited From:
Overrides:
Source:
ServiceContainer.js

started :bool

Flag showing the app is started or not.

Type:
  • bool
Inherited From:
Overrides:
Source:
ServiceContainer.js

workingPath :string

Working directory of this cli app

Type:
  • string
Inherited From:
Overrides:
Source:
ServiceContainer.js

Methods


addFeatureRegistry(registry)

Add more or overide current feature registry

Parameters:
Name Type Description
registry object
Inherited From:
Overrides:
Source:
ServiceContainer.js

enabled(feature)

Check whether a feature is enabled in the app.

Parameters:
Name Type Description
feature string
Inherited From:
Overrides:
Source:
ServiceContainer.js
Returns:
Type
bool

getService(name)

Get a service from module hierarchy

Parameters:
Name Type Description
name
Inherited From:
Overrides:
Source:
ServiceContainer.js
Returns:
Type
object

hasService(name)

Check whether a service exists

Parameters:
Name Type Description
name *
Inherited From:
Overrides:
Source:
ServiceContainer.js
Returns:
Type
boolean

<async> loadConfig_()

Inherited From:
Overrides:
Source:
ServiceContainer.js
Returns:
Type
ServiceContainer

log(level, message, rest)

Default log method, may be override by loggers feature

Parameters:
Name Type Argument Description
level string

Log level

message string

Log message

rest object <repeatable>

Extra meta data

Inherited From:
Overrides:
Source:
ServiceContainer.js
Returns:
Type
ServiceContainer

logException(level, error, summary)

Helper method to log an exception

Parameters:
Name Type Description
level *
error *
summary *
Inherited From:
Overrides:
Source:
ServiceContainer.js
Returns:
Type
ServiceContainer

registerService(name, serviceObject, override)

Register a service

Parameters:
Name Type Description
name string
serviceObject object
override boolean
Inherited From:
Overrides:
Source:
ServiceContainer.js

replaceLogger(logger)

Replace the default logger set on creation of the app.

Parameters:
Name Type Description
logger Logger
Inherited From:
Overrides:
Source:
ServiceContainer.js

<async> start_()

Start the container.

Inherited From:
Overrides:
Source:
ServiceContainer.js
Fires:
Returns:
Type
Promise.<ServiceContainer>

<async> stop_()

Stop the container

Inherited From:
Overrides:
Source:
ServiceContainer.js
Fires:
Returns:
Type
Promise.<ServiceContainer>

toAbsolutePath(args)

Translate a relative path of this app module to an absolute path

Parameters:
Name Type Argument Description
args array <repeatable>

Array of path parts

Inherited From:
Overrides:
Source:
ServiceContainer.js
Returns:
Type
string

Events


configLoaded

Config loaded event.

Inherited From:
Overrides:
Source:
ServiceContainer.js

ready

App ready

Inherited From:
Overrides:
Source:
ServiceContainer.js

stopping

App stopping

Inherited From:
Overrides:
Source:
ServiceContainer.js