UNPKG

@glandjs/express

Version:

An Express adapter for Gland HTTP protocol layer, enabling classic middleware-based routing within the Gland architecture solution.

28 lines (27 loc) 1.22 kB
import { HttpServerAdapter } from '@glandjs/http'; import type { CorsConfig, RouteAction } from '@glandjs/http/types'; import { type Application, type Request, type Response } from 'express'; import { Server } from 'net'; import { EventRecord } from '@glandjs/events'; export declare class ExpressAdapter<TEvents extends EventRecord> extends HttpServerAdapter<Server, Application, Request, Response> { private parserMiddleware; constructor(); json(options?: any): this; urlencoded(options?: { extended?: boolean; }): this; raw(options?: any): this; text(options?: any): this; initialize(): Promise<void> | void; listen(port: number | string, hostname?: string, message?: string): void; reply(response: any, body: any, statusCode?: number): any; use(...args: any[]): any; registerRoute(method: string, path: string, action: RouteAction<Request, Response>): void; enableCors(options: CorsConfig): void; set(key: string, value: any): this; engine(ext: string, engine: any): this; setViewEngine(engine: string): this; setBaseViewsDir(path: string | string[]): this; setGlobalPrefix(prefix: string): void; useStaticAssets(path: string): void; }