Theia API Documentation v1.72.1
    Preparing search index...

    Contribution for hooking into the backend lifecycle:

    • initialize()
    • configure(expressApp)
    • onStart(httpServer)
    • onStop()
    interface BackendApplicationContribution {
        configure?(app: Application): MaybePromise<void>;
        initialize?(): MaybePromise<void>;
        onStart?(
            server:
                | Server<typeof IncomingMessage, typeof ServerResponse>
                | Server<typeof IncomingMessage, typeof ServerResponse>,
        ): MaybePromise<void>;
        onStop?(app?: Application): MaybePromise<void>;
    }

    Hierarchy (View Summary)

    Implemented by

    Index

    Methods

    • Called after the initialization of the backend application is complete. Use this to configure the Express app before it is started, for example to offer additional endpoints.

      The implementation may be async, however it will still block the configuration step until it's resolved.

      Parameters

      • app: Application

        the express application to configure.

      Returns MaybePromise<void>

      either undefined or a Promise resolving to undefined.

    • Called during the initialization of the backend application. Use this for functionality which has to run as early as possible.

      The implementation may be async, however it will still block the initialization step until it's resolved.

      Returns MaybePromise<void>

      either undefined or a Promise resolving to undefined.

    • Called right after the server for the Express app is started. Use this to additionally configure the server or as ready-signal for your service.

      The implementation may be async, however it will still block the startup step until it's resolved.

      Parameters

      • server:
            | Server<typeof IncomingMessage, typeof ServerResponse>
            | Server<typeof IncomingMessage, typeof ServerResponse>

        the backend server running the express app.

      Returns MaybePromise<void>

      either undefined or a Promise resolving to undefined.

    • Called when the backend application shuts down.

      When shutdown is initiated via SIGINT/SIGTERM, contributions are dispatched in parallel and any returned promise is awaited up to SHUTDOWN_TIMEOUT_MS milliseconds while injected services from the root container are still resolvable.

      On synchronous-exit fallback paths (uncaught exceptions, server bind failures, or normal process exit), the hook is invoked synchronously and any returned promise is discarded. Implementations should be resilient to either path.

      Contributions must be independent of one another during stop because they are dispatched in parallel.

      Parameters

      • Optionalapp: Application

        the express application.

      Returns MaybePromise<void>