Skip to main content

createLifecycleMiddleware()

Home > @backstage/backend-app-api > createLifecycleMiddleware

Creates a middleware that pauses requests until the service has started.

Signature:

function createLifecycleMiddleware(options: LifecycleMiddlewareOptions): RequestHandler;

Parameters

ParameterTypeDescription
optionsLifecycleMiddlewareOptions

Returns:

RequestHandler

Remarks

Requests that arrive before the service has started will be paused until startup is complete. If the service does not start within the provided timeout, the request will be rejected with a ServiceUnavailableError.

If the service is shutting down, all requests will be rejected with a ServiceUnavailableError.