thrilled-be-core
Version:
Core Express backend package with middleware, logging, security, and base application setup
90 lines • 2.33 kB
TypeScript
import 'reflect-metadata';
import { Express } from 'express';
import { Logger } from './logging/Logger.js';
import { Plugin } from './plugins/Plugin.js';
import { PluginManager } from './plugins/PluginManager.js';
import { CoreValidationPlugin } from './plugins/ValidationPlugin.js';
import { HealthCheck } from './utils/HealthCheck.js';
import { AppConfig, PluginConfig } from './types/index.js';
export declare class BaseApp {
private config;
private app;
private pluginManager;
private healthCheckManager;
private gracefulShutdown;
private logger;
constructor(config: AppConfig);
/**
* Add a plugin to the application
*/
use(plugin: Plugin, config?: PluginConfig, enabled?: boolean): this;
/**
* Get the Express application instance
*/
getApp(): Express;
/**
* Get the plugin manager instance
*/
getPluginManager(): PluginManager;
/**
* Get the logger instance
*/
getLogger(): Logger;
/**
* Enable a plugin by name
*/
enablePlugin(name: string): boolean;
/**
* Disable a plugin by name
*/
disablePlugin(name: string): boolean;
/**
* Get list of all registered plugins
*/
listPlugins(): {
name: string;
version: string;
enabled: boolean;
}[];
/**
* Setup default plugins that should be included by default
*/
private setupDefaultPlugins;
/**
* Get the validation plugin instance if it exists
*/
getValidationPlugin(): CoreValidationPlugin | undefined;
/**
* Start the application server
*/
start(): Promise<void>;
/**
* Initialize core middleware that should always be present
*/
private initializeCore;
/**
* Initialize all registered plugins
*/
private initializePlugins;
/**
* Create rate limiting middleware
*/
private createRateLimit;
/**
* Start listening on the configured port
*/
private listen;
/**
* Setup default health checks
*/
private setupHealthChecks;
/**
* Add a health check
*/
addHealthCheck(check: HealthCheck): this;
/**
* Add a shutdown handler
*/
addShutdownHandler(handler: () => Promise<void>): this;
}
//# sourceMappingURL=BaseApp.d.ts.map