0.2.0 • Published 6 years ago
kallax v0.2.0
Kallax
Kallax is a service framework for Node.js, built with TypeScript. It provides a uniform way of creating and connecting modules and components.
Minor release versions below 1.0.0 will most likely include breaking changes. I'll try to list them all in the changelogs.
Contents
Installation
$ npm install kallax --save
Usage
Check out the framework starter repository or the docs. Here's a small example:
import { KallaxApp, KallaxModule, IModuleOptions, Module, Service } from 'kallax';
/**
* Create our service
*/
class MyService extends Service<AppModule> {
public belongsToModule = AppModule;
public startupTime = Date.now();
public getUptime(): number {
return Date.now() - this.startupTime;
}
}
/**
* Create our app
*/
class AppModule extends Module {
public static options: IModuleOptions = {
modules: [
KallaxModule,
],
components: [
// Entities
// Services
MyService,
],
};
}
/**
* Bootstrap AppModule
*/
KallaxApp.bootstrap(AppModule).ready(true).then(App => {
App.getLogger().info("KallaxApp ready");
setInterval(() => {
const myService = App.getService(MyService);
App.getLogger().info("Uptime:", myService.getUptime());
}, 5 * 60 * 1000);
}).catch(err => {
console.error(err);
process.exit(err.errno || -1);
});
Changelog
Check out the tags on the repository