-
<async> run( [options], {boolean, args)
-
Run the app. This method will simply call .init() and then .start().
Parameters:
Name |
Type |
Argument |
Description |
options |
object
|
<optional>
|
All the parent class options |
{boolean |
|
|
[options.interceptConsole=false] Redirect console.log(), etc. to default logger |
args |
*
|
<repeatable>
|
Descendant class specific arguments |
- Overrides:
Returns:
-
Type
-
Promise
-
<async> start(args)
-
Start the app
Parameters:
Name |
Type |
Argument |
Description |
args |
*
|
<repeatable>
|
Parent arguments |
- Overrides:
Returns:
-
Type
-
Promise
-
registerInstance(instance, name)
-
Register an instance of a service
Parameters:
Name |
Type |
Description |
instance |
*
|
Instance |
name |
string
|
Name |
- Inherited From:
-
Returns:
Returns name of the service
-
Type
-
string
-
registerClass(classFunc [, filename])
-
Register class function as a service
Parameters:
Name |
Type |
Argument |
Description |
classFunc |
function
|
|
Class function |
filename |
string
|
<optional>
|
Path to the file |
- Inherited From:
-
Returns:
Returns name of the service
-
Type
-
string
-
has(name)
-
Check if service is registered
Parameters:
Name |
Type |
Description |
name |
string
|
Service name |
- Inherited From:
-
Returns:
-
Type
-
boolean
-
get(name, extra)
-
Get instance of a service
Parameters:
Name |
Type |
Argument |
Description |
name |
string
|
RegExp
|
|
Service name or RegExp of names |
extra |
*
|
<repeatable>
|
Optional extra arguments to the constructor |
- Inherited From:
-
Returns:
Returns instance or Map of instances in case of RegExp
-
Type
-
object
|
Map
-
search(re)
-
Search registered services
Parameters:
Name |
Type |
Description |
re |
RegExp
|
Service name RegExp |
- Inherited From:
-
Returns:
Returns array of matching service names
-
Type
-
Array.<string>
-
<async> debug(messages)
-
Debug output
Parameters:
Name |
Type |
Argument |
Description |
messages |
*
|
<repeatable>
|
Messages |
- Inherited From:
-
Returns:
-
Type
-
Promise
-
<async> info(messages)
-
Info output
Parameters:
Name |
Type |
Argument |
Description |
messages |
*
|
<repeatable>
|
Messages |
- Inherited From:
-
Returns:
-
Type
-
Promise
-
<async> error(messages)
-
Error output
Parameters:
Name |
Type |
Argument |
Description |
messages |
*
|
<repeatable>
|
Messages |
- Inherited From:
-
Returns:
-
Type
-
Promise
-
<async> exit(code [, message])
-
Terminate the app. Will call .stop() with start args
Parameters:
Name |
Type |
Argument |
Default |
Description |
code |
number
|
|
0
|
Exit code, default is 0 |
message |
string
|
<optional>
|
|
Exit log message |
- Inherited From:
-
Returns:
-
Type
-
Promise
-
<async> init(args)
-
Initialize the app
Parameters:
Name |
Type |
Argument |
Description |
args |
*
|
<repeatable>
|
Descendant class specific arguments |
- Inherited From:
-
Returns:
-
Type
-
Promise
-
<async> stop(args)
-
Stop the app. Should be overridden.
Descendant must call this (parent) method and stop the app
Parameters:
Name |
Type |
Argument |
Description |
args |
*
|
<repeatable>
|
Descendant-specific arguments |
- Inherited From:
-
Returns:
-
Type
-
Promise
-
<async> onSignal(signal)
-
Handle process signal
Parameters:
Name |
Type |
Description |
signal |
string
|
Signal as SIGNAME |
- Inherited From:
-
Returns:
-
Type
-
Promise
-
<async> _initConfig()
-
Load the configuration
- Inherited From:
-
Returns:
-
Type
-
Promise
-
<async> _initSources()
-
Load the source files
- Inherited From:
-
Returns:
-
Type
-
Promise
-
<async> _initModules()
-
Create modules
- Inherited From:
-
Returns:
-
Type
-
Promise
-
_initService(name [, filename])
-
Initialize as empty and return the item of service container, adding new one if it does not exist yet
Parameters:
Name |
Type |
Argument |
Description |
name |
string
|
|
Name of the service |
filename |
string
|
<optional>
|
Path to the class |
- Inherited From:
-
Returns:
Returns service object
-
Type
-
object
-
_resolveService(name, extra, request)
-
Resolve dependencies and return an instance of a service
Parameters:
Name |
Type |
Description |
name |
string
|
Service name |
extra |
Array
|
Extra constructor arguments |
request |
Map
|
Resolved dependencies |
- Inherited From:
-
Returns:
Returns instance of the service
-
Type
-
object
-
_instantiateClass(service, extra, request)
-
Instantiate given service class
Parameters:
Name |
Type |
Description |
service |
object
|
Service object |
extra |
Array
|
Extra constructor arguments |
request |
Map
|
Resolved dependencies |
- Inherited From:
-
Returns:
Returns instance of the class
-
Type
-
object
-
<async> _output(stream, messages)
-
Print output
Parameters:
Name |
Type |
Description |
stream |
*
|
Stream for output |
messages |
Array
|
Messages |
- Inherited From:
-
Returns:
-
Type
-
Promise
-
<async> _autoload(basePath, dirs)
-
Load given directories
Parameters:
Name |
Type |
Description |
basePath |
string
|
Base path |
dirs |
Array.<string>
|
Directories |
- Inherited From:
-
Returns:
-
Type
-
Promise