new Runnable(name [, options])
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
name |
string | The name of the application. |
|
options |
object |
<optional> |
Application options |
- Source:
- Runnable.js
Properties:
| Name | Type | Argument | Default | Description |
|---|---|---|---|---|
options.logger |
object |
<optional> |
Logger options |
|
options.ignoreUncaught |
object |
<optional> |
false | Whether to skip the handling of uncaught exception |
options.exitOnUncaught |
object |
<optional> |
true | Whether to exit process on uncaught exception thrown |
Methods
-
<static> getLib(libName)
-
Get the lib module
Parameters:
Name Type Description libNamestring - Source:
- Runnable.js
-
<static> getService(name)
-
Get a registered service
Parameters:
Name Type Description namestring - Source:
- Runnable.js
Example
// Get service from a lib module const service = app.getService('<lib name>/<service name>'); // e.g const service = app.getService('data/mysql.mydb'); -
<static> registerLib(lib)
-
Register a loaded lib module
Parameters:
Name Type Description libLibModule - Source:
- Runnable.js
-
<static> requireFromLib(relativePath)
-
Require a module from the source path of a library module
Parameters:
Name Type Description relativePath* - Source:
- Runnable.js
-
<static> resetLogger()
-
Reset logger.
Use it only if the options.logger config is changed in runtime- Source:
- Runnable.js
-
<async, static> start_()
-
Start the app
- Source:
- Runnable.js
Returns:
- Type
- Promise
-
<async, static> stop_()
-
Stop the app
- Source:
- Runnable.js
Returns:
- Type
- Promise