Extends
- EventEmitter
Members
Type:
App
Type:
AppManager
Type:
AppManager
Type:
AppStatus
Type:
CommonList
see affiliated serviser-config npm package
Type:
Config
Type:
ErrorList
Type:
ModuleLoader
Type:
RemoteServiceManager
Type:
RemoteServiceManager
Type:
RequestType
Type:
ResourceManager
ResourceManager is used for any resource that can be inspected for
its integrity eg. storage connections, remote dependent API services,
config provider etc...
Type:
ResourceManager
Type:
Response
Type:
Route
Type:
Router
self reference
Type:
Service
self reference
Type:
Service
Type:
Utils
serviser npm package version
Type:
String
Constructor
- config
- Type:
Config npm serviser-config object
The main representation of a service as a whole.
Holds AppManager, ResourceManager, RemoteServiceManager as well as global
service configuration (Config) object. Optionally can hold references to
Model managers of various ODMs/ORMs
Parameters:
Fires:
Methods
- name
- Type:
String application name as defined in
apps.<name>of service configuration file (config.js)- options optional
- Type:
Object see
Appconstructor options- Constructor optional
- Type:
function - Default:
App a constructor which implements
AppInterface
AppInterface
syntax sugar for building an application (defaults to express based App) via AppManager
Parameters:
AppInterface
Promise
calls App#close on each App in the AppManager
Promise
RemoteServiceManager
returns RemoteServiceManager or constructs one if there isn't any. This
requires serviser-sdk npm module to be available
RemoteServiceManager
Events
- yargs
- Type:
Object preconfigured instance of yargs npm package
- service
- Type:
Service - appManager
- Type:
AppManager service.appManager
- config
- Type:
Config service.config
- yargs
- Type:
Object
one of the registered apps failed to initialize
all registered apps are successfully initialized and at this point already can receive connections
The event is emitted after service configuration and all registered resources are validated and ready for use.
Listeners are expected to do any initial asynchronous processing if needed and then register Apps with Router & Route definitions.
The listeners are handled asynchronously and so can deal with Promises
Example:
//$PROJECT_ROOT/index.js
const Service = require('serviser');
const service = new Service(require('serviser-config'));
service.once('set-up', function() {
require('./lib/app.js');
});
emitted once prior a shell command dispatching. Allows to register custom user-defined shell commands. See serviser-shell plugin
Properties:
for serviser plugins.
emitted once for each instantiated Service object.
Properties:
Example:
const Service = require('serviser');
Service.on('service', function(service) {
//do stuff
});
this event allows to hook-up serviser plugins and is static version of Service#event:set-up event.
Properties:
Example:
const Service = require('serviser');
Service.on('set-up', function(appManager, config) {
//do stuff
});
for serviser plugins.
emitted once prior a shell command is dispatched. Allows to register
custom user-defined shell commands.
See serviser-shell
plugin