Const
It provides bindings which are scoped per a connection, e.g. in order to allow backend services to access frontend service within the same connection.
const myConnectionModule = ConnectionContainerModule.create(({ bindFrontendService }) => { bindFrontendService(myFrontendServicePath, MyFrontendService);});export const myBackendApplicationModule = new ContainerModule(bind => { bind(ConnectionContainerModule).toConstantValue(myConnectionModule);} Copy
const myConnectionModule = ConnectionContainerModule.create(({ bindFrontendService }) => { bindFrontendService(myFrontendServicePath, MyFrontendService);});export const myBackendApplicationModule = new ContainerModule(bind => { bind(ConnectionContainerModule).toConstantValue(myConnectionModule);}
const myConnectionModule2 = ConnectionContainerModule.create(({ bind, bindBackendService }) => { bind(MyBackendService).toSelf().inSingletonScope(); bindBackendService(myBackendServicePath, MyBackendService);});export const myBackendApplicationModule2 = new ContainerModule(bind => { bind(ConnectionContainerModule).toConstantValue(myConnectionModule2);} Copy
const myConnectionModule2 = ConnectionContainerModule.create(({ bind, bindBackendService }) => { bind(MyBackendService).toSelf().inSingletonScope(); bindBackendService(myBackendServicePath, MyBackendService);});export const myBackendApplicationModule2 = new ContainerModule(bind => { bind(ConnectionContainerModule).toConstantValue(myConnectionModule2);}
@injectable()export class MyBackendService { @inject(MyFrontendService) protected readonly myFrontendService: MyFrontendService;} Copy
@injectable()export class MyBackendService { @inject(MyFrontendService) protected readonly myFrontendService: MyFrontendService;}
Connection Container Module
It provides bindings which are scoped per a connection, e.g. in order to allow backend services to access frontend service within the same connection.
Binding a frontend service
Exposing a backend service
Injecting a frontend service