UNPKG

helene

Version:
35 lines (34 loc) 1.2 kB
import express from 'express'; import http from 'http'; import { ClientNode } from '../client-node'; import { RateLimit, Server } from '../server'; declare module 'express' { interface Request { context?: Record<string, any>; } } export declare enum HttpTransportEvents { HTTP_LISTENING = "http:listening", HTTP_SERVER_ERROR = "http:server:error", HTTP_SERVER_CLOSED = "http:server:closed" } export type RequestTransport = { context: any; payload?: Record<string, any>; }; export declare class HttpTransport { server: Server; http: http.Server; express: express.Express; constructor(server: Server, origins: string[], limit: RateLimit); setCORS(origins: string[]): void; getServerContext(clientNode: ClientNode, context?: any): Promise<any>; requestHandler: (req: express.Request, res: express.Response) => Promise<express.Response<any, Record<string, any>>>; contextMiddleware(req: any, res: any, next: any): Promise<void>; authMiddleware(req: any, res: any, next: any): Promise<any>; static(path: string, catchAll: boolean): void; /** * Need to close WebSocket server first. */ close(): Promise<void>; }