///
import { Injector } from '@ascot/common';
import { WSClass } from './meta/models';
import { WSEndpoint } from './meta/endpoint';
import { WSModel } from './meta/model';
import { WebService } from './models/base';
import Koa from 'koa';
import http from 'http';
export interface HTTPServerOptions {
baseUrl?: string;
port: number;
middlewares?: any[];
errorHandlers?: ((err: any, ctx: any) => void)[];
register: (plugin: HTTPServer) => void;
di?: Injector;
bodyParser?: any;
busboy?: any;
cors?: boolean | {
origin?: string | ((ctx: any) => string);
allowMethods?: string | string[];
exposeHeaders?: string | string[];
allowHeaders?: string | string[];
maxAge?: string | number;
credentials?: boolean | ((ctx: any) => boolean);
keepHeadersOnError?: boolean;
secureContext?: boolean;
privateNetworkAccess?: boolean;
};
}
export declare class HTTPServer {
options: HTTPServerOptions;
protected koa: Koa;
protected router: any;
protected server: http.Server;
protected endpoints: {
[path: string]: {
meta: WSEndpoint;
handler: (...args: any[]) => any | Promise;
};
};
protected services: {
[key: string]: {
meta: WSModel;
instance: WebService;
};
};
private di;
constructor(options: HTTPServerOptions);
start(): Promise;
stop(): Promise;
register(ws: WSClass): Promise;
}