I am new to Typescript and InversifyJS. What I am trying to achieve is to share variable value across multiple files. I am setting the value on the server startup on main.ts and I am trying to fetch that value from a controller. What I did is I created a @injectable service file
service.ts
import { injectable } from 'inversify';
@injectable()
export class SetGetService {
private _client : any;
get () : any {
return this._client;
}
set (client: any) {
this._client = client;
}
}
I am able to set the value from main.ts, but after calling the SetGetService on other files, it was undefined or empty. It seems like it was being reset or cleared.