Clout

clout-js/lib/Clout~ Clout

Clout application

Constructor

new Clout(rootDirectory)

Source:
Parameters:
Name Type Description
rootDirectory path application directory

Methods

addApi(path, fn)

Add API
Source:
Parameters:
Name Type Description
path string api path
fn function express function

addModule(moduleName)

Load clout-js node module
Source:
Parameters:
Name Type Description
moduleName string clout node module name

loadHooksFromDir(dir) → {Promise}

Loads hooks from directory
Source:
Parameters:
Name Type Description
dir Path directory
Returns:
Type:
Promise
promise

registerHook(event, fn, priority, override)

hook into clout runtime
Source:
Parameters:
Name Type Description
event string event name
fn function function to execute
Name Type Description
_name String hook name
group String hook group
priority Number function priority
override Boolean override existing
Example
// register a function to the hook
clout.registerHook('start', function (next) {
	next();
});
// invoking an error in clout runtime
clout.registerHook('start', function (next) {
	next(new Error('Error executing function'));
});

reload() → {Promise}

Reload clout
Source:
Returns:
Type:
Promise
returns a promise

start() → {Promise}

Start clout
Source:
Returns:
Type:
Promise
returns a promise

stop() → {Promise}

Stop clout
Source:
Returns:
Type:
Promise
returns a promise