BSB Node.js Type Definitions
    Preparing search index...

    Class ServiceBase

    Main entry point for the BSB framework.

    This class is responsible for initializing and running the BSB framework. You can override the default behaviour of the framework by passing in your own classes for the plugins, logging, metrics, events and services. The passed in classes are not the plugins themselves, but rather the classes that handle the plugin creation, setup and running.

    Index

    Factory

    • Create a ServiceBase instance with simple configuration

      Parameters

      Returns ServiceBase

      New ServiceBase instance

      const app = ServiceBase.create({
      cwd: './my-app',
      plugins: ['logging-default', 'events-default']
      });
    • Create a ServiceBase instance from a preset

      Parameters

      • preset: BSBPreset

        Preset configuration type

      • Optionaloverrides: Partial<BSBOptions>

        Additional options to override preset defaults

      Returns ServiceBase

      New ServiceBase instance

      const app = ServiceBase.fromPreset(BSBPreset.DEVELOPMENT, { 
      cwd: './my-app'
      });
    • Create a minimal ServiceBase instance for quick prototyping

      Parameters

      • Optionalcwd: string

        Working directory (defaults to process.cwd())

      Returns ServiceBase

      New ServiceBase instance with minimal configuration

      const app = ServiceBase.minimal('./my-app');
      await app.init();
      await app.run();
    • Create a development ServiceBase instance with debug logging

      Parameters

      • Optionalcwd: string

        Working directory (defaults to process.cwd())

      Returns ServiceBase

      New ServiceBase instance configured for development

    • Create a production ServiceBase instance with optimized settings

      Parameters

      • Optionalcwd: string

        Working directory (defaults to process.cwd())

      Returns ServiceBase

      New ServiceBase instance configured for production

    Other

    • Initialize all subsystems and plugins

      Returns Promise<void>

    • Run the application after initialization

      Returns Promise<void>

    • Dispose all subsystems and exit process with code

      Parameters

      • eCode: number = 0
      • reason: string
      • OptionalextraData: any

      Returns Promise<void>

    • Add a service plugin programmatically

      Parameters

      Returns Promise<BSBServiceRef>