0.1.7 • Published 7 years ago
uon.app v0.1.7
UON APP Framework
Usage
npm install uon.app --save
const Application = require('uon.app');
// instanciate an Application with options
const my_app = new Application({
// will launch one process on each physical core
cluster: true,
});
// start the app with a list of bundles to init
my_app.start({
// Load a bundle by name
'mybundle' : {
services : {
'MyService' : {
option1 : 1234
}
}
},
'my_preloaded_bundle' : {
bundle : require('./InProjectBundle')
}
});
To define a bundle you can use :
const Bundle = require('uon.app').Bundle;
const MyBundle = new Bundle(['MyOtherModule1', 'MyOtherModule2']);
MyBundle.service('MyService', ['OtherService', (options, OtherService) => {
// service implementation
...
}]);
module.exports = MyBundle;
In package.json you must specify where the bundle is located
{
...
"bundle" : "./bundle.js"
...
}
TODOs
- Finish this README
- More documentation and comments