UNPKG

thrilled-be-core

Version:

Core Express backend package with middleware, logging, security, and base application setup

54 lines 1.59 kB
import { BasePlugin } from '../'; import type { Express } from 'express'; /** * Example: Authentication Plugin * * This example shows how to create a sophisticated plugin with: * - Custom configuration * - Middleware registration * - Route protection * - Error handling */ interface AuthConfig { jwtSecret: string; tokenExpiry: string; publicRoutes: string[]; } declare class AuthenticationPlugin extends BasePlugin { readonly name = "authentication"; readonly version = "2.0.0"; private config; protected setup(config: AuthConfig): Promise<void>; protected registerMiddleware(app: Express): void; protected registerRoutes(app: Express): void; protected registerErrorHandlers(app: Express): void; } /** * Example: Metrics Collection Plugin * * This example shows how to: * - Collect application metrics * - Provide metrics endpoints * - Use timers and counters */ interface MetricsConfig { enabled: boolean; endpoint: string; collectSystemMetrics: boolean; } declare class MetricsPlugin extends BasePlugin { readonly name = "metrics"; readonly version = "1.5.0"; private config; private metrics; protected setup(config: MetricsConfig): void; private startSystemMetricsCollection; protected registerMiddleware(app: Express): void; protected registerRoutes(app: Express): void; } /** * Example: How to use these plugins in an application */ export declare function createExampleApplication(): any; export { AuthenticationPlugin, MetricsPlugin }; //# sourceMappingURL=plugin-development.d.ts.map