How to use the @loopback/core.CoreBindings.APPLICATION_INSTANCE function in @loopback/core

To help you get started, we’ve selected a few @loopback/core 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 strongloop / loopback-next / packages / boot / src / booters / service.booter.ts View on Github external
constructor(
    @inject(CoreBindings.APPLICATION_INSTANCE)
    public app: ApplicationWithServices,
    @inject(BootBindings.PROJECT_ROOT) projectRoot: string,
    @config()
    public serviceConfig: ArtifactOptions = {},
  ) {
    super(
      projectRoot,
      // Set Service Booter Options if passed in via bootConfig
      Object.assign({}, ServiceDefaults, serviceConfig),
    );
  }
github strongloop / loopback-next / packages / boot / src / bootstrapper.ts View on Github external
constructor(
    @inject(CoreBindings.APPLICATION_INSTANCE)
    private app: Application & Bootable,
    @inject(BootBindings.PROJECT_ROOT) private projectRoot: string,
    @inject(BootBindings.BOOT_OPTIONS, {optional: true})
    private bootOptions: BootOptions = {},
  ) {
    // Resolve path to projectRoot and re-bind
    this.projectRoot = resolve(this.projectRoot);
    app.bind(BootBindings.PROJECT_ROOT).to(this.projectRoot);

    // This is re-bound for testing reasons where this value may be passed directly
    // and needs to be propagated to the Booters via DI
    app.bind(BootBindings.BOOT_OPTIONS).to(this.bootOptions);
  }
github strongloop / loopback-next / packages / boot / src / booters / lifecyle-observer.booter.ts View on Github external
constructor(
    @inject(CoreBindings.APPLICATION_INSTANCE)
    public app: Application,
    @inject(BootBindings.PROJECT_ROOT) projectRoot: string,
    @config()
    public observerConfig: ArtifactOptions = {},
  ) {
    super(
      projectRoot,
      // Set LifeCycleObserver Booter Options if passed in via bootConfig
      Object.assign({}, LifeCycleObserverDefaults, observerConfig),
    );
  }
github strongloop / loopback-next / packages / boot / src / booters / controller.booter.ts View on Github external
constructor(
    @inject(CoreBindings.APPLICATION_INSTANCE) public app: Application,
    @inject(BootBindings.PROJECT_ROOT) projectRoot: string,
    @config()
    public controllerConfig: ArtifactOptions = {},
  ) {
    super(
      projectRoot,
      // Set Controller Booter Options if passed in via bootConfig
      Object.assign({}, ControllerDefaults, controllerConfig),
    );
  }
github strongloop / loopback-next / packages / boot / src / booters / repository.booter.ts View on Github external
constructor(
    @inject(CoreBindings.APPLICATION_INSTANCE)
    public app: ApplicationWithRepositories,
    @inject(BootBindings.PROJECT_ROOT) projectRoot: string,
    @config()
    public repositoryOptions: ArtifactOptions = {},
  ) {
    super(
      projectRoot,
      // Set Repository Booter Options if passed in via bootConfig
      Object.assign({}, RepositoryDefaults, repositoryOptions),
    );
  }
github strongloop / loopback-next / packages / boot / src / booters / interceptor.booter.ts View on Github external
constructor(
    @inject(CoreBindings.APPLICATION_INSTANCE)
    public app: Application,
    @inject(BootBindings.PROJECT_ROOT) projectRoot: string,
    @config()
    public interceptorConfig: ArtifactOptions = {},
  ) {
    super(
      projectRoot,
      // Set InterceptorProvider Booter Options if passed in via bootConfig
      Object.assign({}, InterceptorProviderDefaults, interceptorConfig),
    );
  }
github strongloop / loopback-next / examples / todo / src / controllers / model-admin.controller.ts View on Github external
constructor(
    @inject(CoreBindings.APPLICATION_INSTANCE)
    private app: TodoListApplication,
  ) {}
github strongloop / loopback-next / examples / rpc-server / src / rpc.server.ts View on Github external
constructor(
    @inject(CoreBindings.APPLICATION_INSTANCE) public app?: Application,
    @inject('rpcServer.config') public config?: RPCServerConfig,
  ) {
    super(app);
    this.config = config ?? {};
    this.expressServer = express();
    rpcRouter(this);
  }
github strongloop / loopback-next / packages / v3compat / src / boot / lb3-model-booter.ts View on Github external
constructor(
    @inject(CoreBindings.APPLICATION_INSTANCE)
    public app: Application & {v3compat: Lb3Application},
    @inject(BootBindings.PROJECT_ROOT)
    public projectRoot: string,
    @inject(`${BootBindings.BOOT_OPTIONS}#v3compat`)
    options: Partial = {},
  ) {
    this.options = Object.assign({}, DefaultOptions, options);
  }
github strongloop / loopback-next / packages / boot / src / booters / application-metadata.booter.ts View on Github external
constructor(
    @inject(CoreBindings.APPLICATION_INSTANCE) public app: Application,
    @inject(BootBindings.PROJECT_ROOT) private projectRoot: string,
  ) {}