UNPKG

@nodeboot/ghost-server

Version:

Node-Boot Ghost Server for Pure IoC Applications. Suitable for Auto-configuration testing, background jobs, etc

38 lines 1.92 kB
import { Action, ActionMetadata, MiddlewareMetadata, NodeBootEngineOptions, ParamMetadata } from "@nodeboot/context"; import { NodeBootDriver } from "@nodeboot/engine"; export type GhostServerRequest = { params?: Record<string, any>; query?: Record<string, any>; body?: any; headers?: Record<string, string>; session?: Record<string, any>; cookies?: Record<string, string>; file?: any; files?: any; }; export type GhostServerResponse = { statusCode?: number; headers?: Record<string, string>; body?: any; redirectUrl?: string; renderedTemplate?: { template: string; options: any; }; sendCalled?: boolean; }; export declare class GhostServerDriver extends NodeBootDriver<null, Action<GhostServerRequest, GhostServerResponse>> { private customErrorHandler?; private globalErrorHandler; constructor(); initialize(): void; registerAction(_m: ActionMetadata, _a: (action: Action<GhostServerRequest, GhostServerResponse, Function>) => Promise<any>): void; registerRoutes(): void; registerMiddleware(middleware: MiddlewareMetadata, _options: NodeBootEngineOptions): void; executeAction(actionMetadata: ActionMetadata, actionData: GhostServerRequest, executeAction: (action: Action<GhostServerRequest, GhostServerResponse>) => Promise<any>): Promise<GhostServerResponse>; checkAuthorization(request: GhostServerRequest, response: GhostServerResponse, actionMetadata: ActionMetadata): Promise<void>; getParamFromRequest(action: Action<GhostServerRequest, GhostServerResponse>, param: ParamMetadata): any; handleError(error: any, action: Action<GhostServerRequest, GhostServerResponse>, actionMetadata?: ActionMetadata): Promise<void>; handleSuccess(result: any, action: Action<GhostServerRequest, GhostServerResponse>, actionMetadata: ActionMetadata): void; } //# sourceMappingURL=GhostServerDriver.d.ts.map