UNPKG

2.62 kBTypeScriptView Raw
1import { HttpServer, RequestMethod } from '@nestjs/common';
2import { RequestHandler } from '@nestjs/common/interfaces';
3import { CorsOptions } 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 readonly instance: any;
10 protected httpServer: TServer;
11 constructor(instance: any);
12 use(...args: any[]): any;
13 get(handler: RequestHandler): any;
14 get(path: any, handler: RequestHandler): any;
15 post(handler: RequestHandler): any;
16 post(path: any, handler: RequestHandler): any;
17 head(handler: RequestHandler): any;
18 head(path: any, handler: RequestHandler): any;
19 delete(handler: RequestHandler): any;
20 delete(path: any, handler: RequestHandler): any;
21 put(handler: RequestHandler): any;
22 put(path: any, handler: RequestHandler): any;
23 patch(handler: RequestHandler): any;
24 patch(path: any, handler: RequestHandler): any;
25 options(handler: RequestHandler): any;
26 options(path: any, handler: RequestHandler): any;
27 listen(port: string | number, callback?: () => void): any;
28 listen(port: string | number, hostname: string, callback?: () => void): any;
29 getHttpServer(): TServer;
30 setHttpServer(httpServer: TServer): void;
31 getInstance<T = any>(): T;
32 abstract close(): any;
33 abstract initHttpServer(options: NestApplicationOptions): any;
34 abstract useStaticAssets(...args: any[]): any;
35 abstract setViewEngine(engine: string): any;
36 abstract getRequestHostname(request: any): any;
37 abstract getRequestMethod(request: any): any;
38 abstract getRequestUrl(request: any): any;
39 abstract status(response: any, statusCode: number): any;
40 abstract reply(response: any, body: any, statusCode?: number): any;
41 abstract render(response: any, view: string, options: any): any;
42 abstract redirect(response: any, statusCode: number, url: string): any;
43 abstract setErrorHandler(handler: Function, prefix?: string): any;
44 abstract setNotFoundHandler(handler: Function, prefix?: string): any;
45 abstract setHeader(response: any, name: string, value: string): any;
46 abstract registerParserMiddleware(prefix?: string): any;
47 abstract enableCors(options: CorsOptions, prefix?: string): any;
48 abstract createMiddlewareFactory(requestMethod: RequestMethod): (path: string, callback: Function) => any;
49 abstract getType(): string;
50}