Alokai

MiddlewareConfig

interface MiddlewareConfig<TIntegrationsContext extends Record<string, IntegrationContext> = Record<string, IntegrationContext>> {
	errorHandler?: ErrorHandler;
	helmet?: boolean | Readonly<HelmetOptions>;
	integrations: Integrations<TIntegrationsContext>;
	logger?: LoggerOptions;
}

Properties

NameRequiredTypeDescription
errorHandlerOptionalErrorHandlerGlobal error handler for all integrations. When to use: Define this in middleware.config.ts when you want consistent error handling across all integrations. Individual integrations can still override this with their own handler. Priority: Integration-specific > Global > Built-in default Scope: Only handles errors from integration endpoints (/:integrationName/*). Errors from non-integration routes (e.g., /healthz or custom routes) are not handled by this. Handles: API errors, body parser errors (invalid JSON), and other middleware errors that occur during integration endpoint execution.
helmetOptionalboolean | Readonly<HelmetOptions>
integrationsRequiredIntegrations<TIntegrationsContext>
loggerOptionalLoggerOptions

Referenced Types

On this page