@tsclean/core
Version:
Plugin for API Rest Full development, based on Clean Architecture, IoC and Dependency Injection.
47 lines • 2.61 kB
TypeScript
import { CorsOptions, CorsOptionsDelegate, HttpServer, ApplicationOptionsInterface } from '../../contracts';
import { RequestMethod } from '../../enums';
import { RequestHandlerType } from '../../types';
export declare abstract class AbstractHttpAdapter<S = any, T = any, R = any> implements HttpServer<T, R> {
protected instance?: any;
protected httpServer: S;
protected constructor(instance?: any);
init(): Promise<void>;
use(...args: any[]): any;
get(handler: RequestHandlerType): any;
get(path: any, handler: RequestHandlerType): any;
post(handler: RequestHandlerType): any;
post(path: any, handler: RequestHandlerType): any;
head(handler: RequestHandlerType): any;
head(path: any, handler: RequestHandlerType): any;
delete(handler: RequestHandlerType): any;
delete(path: any, handler: RequestHandlerType): any;
put(handler: RequestHandlerType): any;
put(path: any, handler: RequestHandlerType): any;
patch(handler: RequestHandlerType): any;
patch(path: any, handler: RequestHandlerType): any;
all(handler: RequestHandlerType): any;
all(path: any, handler: RequestHandlerType): any;
options(handler: RequestHandlerType): any;
options(path: any, handler: RequestHandlerType): any;
listen(port: string | number, callback?: () => void): any;
listen(port: string | number, hostname: string, callback?: () => void): any;
getHttpServer(): S;
getInstance<T = any>(): T;
abstract close(): any;
abstract initHttpServer(options: ApplicationOptionsInterface): any;
abstract getRequestHostname(request: any): any;
abstract getRequestMethod(request: any): any;
abstract getRequestUrl(request: any): any;
abstract status(response: any, statusCode: number): any;
abstract reply(response: any, body: any, statusCode?: number): any;
abstract render(response: any, view: string, options: any): any;
abstract redirect(response: any, statusCode: number, url: string): any;
abstract setErrorHandler(handler: Function, prefix?: string): any;
abstract setNotFoundHandler(handler: Function, prefix?: string): any;
abstract setHeader(response: any, name: string, value: string): any;
abstract registerParserMiddleware(prefix?: string): any;
abstract enableCors(options: CorsOptions | CorsOptionsDelegate<T>, prefix?: string): any;
abstract createMiddlewareFactory(requestMethod: RequestMethod): ((path: string, callback: Function) => any) | Promise<(path: string, callback: Function) => any>;
abstract getType(): string;
}
//# sourceMappingURL=http-adapter.d.ts.map