UNPKG

2.88 kBTypeScriptView Raw
1import { HttpServer, RequestMethod } from '@nestjs/common';
2import { RequestHandler } from '@nestjs/common/interfaces';
3import { CorsOptions, CorsOptionsDelegate } from '@nestjs/common/interfaces/external/cors-options.interface';
4import { NestApplicationOptions } from '@nestjs/common/interfaces/nest-application-options.interface';
5/**
6 * @publicApi
7 */
8export declare abstract class AbstractHttpAdapter<TServer = any, TRequest = any, TResponse = any> implements HttpServer<TRequest, TResponse> {
9 protected instance?: any;
10 protected httpServer: TServer;
11 constructor(instance?: any);
12 init(): Promise<void>;
13 use(...args: any[]): any;
14 get(handler: RequestHandler): any;
15 get(path: any, handler: RequestHandler): any;
16 post(handler: RequestHandler): any;
17 post(path: any, handler: RequestHandler): any;
18 head(handler: RequestHandler): any;
19 head(path: any, handler: RequestHandler): any;
20 delete(handler: RequestHandler): any;
21 delete(path: any, handler: RequestHandler): any;
22 put(handler: RequestHandler): any;
23 put(path: any, handler: RequestHandler): any;
24 patch(handler: RequestHandler): any;
25 patch(path: any, handler: RequestHandler): any;
26 all(handler: RequestHandler): any;
27 all(path: any, handler: RequestHandler): any;
28 options(handler: RequestHandler): any;
29 options(path: any, handler: RequestHandler): any;
30 listen(port: string | number, callback?: () => void): any;
31 listen(port: string | number, hostname: string, callback?: () => void): any;
32 getHttpServer(): TServer;
33 setHttpServer(httpServer: TServer): void;
34 setInstance<T = any>(instance: T): void;
35 getInstance<T = any>(): T;
36 abstract close(): any;
37 abstract initHttpServer(options: NestApplicationOptions): any;
38 abstract useStaticAssets(...args: any[]): any;
39 abstract setViewEngine(engine: string): any;
40 abstract getRequestHostname(request: any): any;
41 abstract getRequestMethod(request: any): any;
42 abstract getRequestUrl(request: any): any;
43 abstract status(response: any, statusCode: number): any;
44 abstract reply(response: any, body: any, statusCode?: number): any;
45 abstract render(response: any, view: string, options: any): any;
46 abstract redirect(response: any, statusCode: number, url: string): any;
47 abstract setErrorHandler(handler: Function, prefix?: string): any;
48 abstract setNotFoundHandler(handler: Function, prefix?: string): any;
49 abstract setHeader(response: any, name: string, value: string): any;
50 abstract registerParserMiddleware(prefix?: string): any;
51 abstract enableCors(options: CorsOptions | CorsOptionsDelegate<TRequest>, prefix?: string): any;
52 abstract createMiddlewareFactory(requestMethod: RequestMethod): ((path: string, callback: Function) => any) | Promise<(path: string, callback: Function) => any>;
53 abstract getType(): string;
54}