How to use the @tsed/di.InjectorService function in @tsed/di

To help you get started, we’ve selected a few @tsed/di examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TypedProject / ts-express-decorators / packages / common / src / server / utils / createInjector.ts View on Github external
export function createInjector(settings: any = {}) {
  const injector = new InjectorService();

  // Init settings
  injector.settings = createSettingsService(injector);
  injector.logger = $log;

  injector.settings.scopes = {
    ...(settings.scopes || {}),
    [ProviderType.CONTROLLER]: settings.controllerScope
  };

  // @ts-ignore
  injector.settings.set(settings);

  /* istanbul ignore next */
  if (injector.settings.env === "test") {
    injector.logger.stop();