Class: Host

Host

This is the main class of the program. The constructor initializes an injector and registry for the application. The bootstrap method uses the registry to find, load, validate and initialize plugins. The run method starts the application.

Examples

Host Application

module.exports = require('sunstone').bootstrap({
  directories: [
    path.join(__dirname, 'plugins'),
    path.join(process.cwd(), 'plugins')
  ]
})

Extending Application

require('my-app').run()

This class requires the modules Registry.

Constructor

new Host(options)

Initialize a Host.

Parameters:
Name Type Description
options Object

Options object

Source:
To Do:
  • decide how to handle directory/node_modules configuration
  • needs to handle customized plugin directories

Methods

(static) bootstrap(options) → {Host}

Create a new Host instance with the provided options and initialize the application.

Parameters:
Name Type Description
options Object

Options object

Source:
Returns:
Type
Host

run()

Run starts the application by injecting the main dependency, then iterating through all the plugins and starting each of them.

Source: