@ckenx/kenx-fastify
Version:
Kenx fastify framework plugin
25 lines (24 loc) • 1.11 kB
TypeScript
/// <reference types="node" />
import type { ServerPlugin, ApplicationPlugin, SetupManager, HTTPServer } from '@ckenx/node';
import type { FastifyInstance, FastifyPluginAsync } from 'fastify';
import type { Config, JSObject } from './types';
import EventEmitter from 'events';
export default class FastifyPlugin extends EventEmitter implements ApplicationPlugin<FastifyInstance> {
readonly HOST: string;
readonly PORT: number;
readonly core: FastifyInstance;
private readonly Setup;
private AUTO_HANDLE_ERROR;
private useSession;
private useAssets;
private useRouting;
private eventListeners;
constructor(Setup: SetupManager, config: Config);
register(plugin: FastifyPluginAsync, options?: JSObject<unknown>): this;
use(fn: any, type?: string): this;
attach(attribute: string, value: unknown): this;
router(prefix: string, route: (app: FastifyInstance) => Promise<void>): this;
private handleError;
onError(listener: (error: Error, req: Request, rep: Response) => void): this;
serve(overhead?: boolean): Promise<ServerPlugin<HTTPServer>>;
}