import { App, Cord } from '@botorjs/cord';
var cord: Cord = new Cord();
cord.boot.hook.on("start", () => {
console.log("start work");
})
cord.root(__dirname)
.preload()
.fire();
var service = cord.boot.get<ServiceTest>(ServiceTest);
expect(service.count).to.eql(1);
service.sub();
expect(service.count).to.eql(0);
var env: Env = cord.boot.get<Env>(Env);
var val = env.get("TEST_ENV");
expect(val).to.eql("test");
API
Cord
Cord is backgroud connect to component
Property
Description
config
get config cord
boot
get Boot
root(folder)
set folder root of appliction
preload()
Preload application, it will load the ServiceProvider to Boot and load Alisa to boot. Load environment and file .env (defaul config) to Env and add to IoC of Boot
fire
call event to system notification start application
Env
load config in file .env(default) to environment and get set environment
Property
Description
get
get value environment
set
set value environment
ConfigCord
load config in file .env(default) to environment and get set environment
Property
Description
Defaul
start_folder
Folder the file start is config input of component