Main Initializer

When an application starts it can trigger some code. If you add a main.js file to the root of your application (/src/main/resources/) this file is executed when the application starts. Here it’s possible to add various initialization code or add event listeners to listen for events.

Simple example:

// Log application started
log.info('Application ' + app.name + ' started');

Running code on stop:

// Log application started
log.info('Application ' + app.name + ' started');

// Log when application is stopped
__.disposer(function() {
    log.info('Application ' + app.name + ' stopped');
});