UNPKG

3.19 kBTypeScriptView Raw
1import type { Server } from 'http';
2import { RequestMethod, VersioningOptions } from '@nestjs/common';
3import { VersionValue } from '@nestjs/common/interfaces';
4import { CorsOptions, CorsOptionsDelegate } from '@nestjs/common/interfaces/external/cors-options.interface';
5import { NestApplicationOptions } from '@nestjs/common/interfaces/nest-application-options.interface';
6import { AbstractHttpAdapter } from '@nestjs/core/adapters/http-adapter';
7import * as http from 'http';
8import * as https from 'https';
9import { NestExpressBodyParserOptions } from '../interfaces/nest-express-body-parser-options.interface';
10import { NestExpressBodyParserType } from '../interfaces/nest-express-body-parser.interface';
11import { ServeStaticOptions } from '../interfaces/serve-static-options.interface';
12type VersionedRoute = <TRequest extends Record<string, any> = any, TResponse = any>(req: TRequest, res: TResponse, next: () => void) => any;
13/**
14 * @publicApi
15 */
16export declare class ExpressAdapter extends AbstractHttpAdapter<http.Server | https.Server> {
17 private readonly routerMethodFactory;
18 private readonly logger;
19 private readonly openConnections;
20 constructor(instance?: any);
21 reply(response: any, body: any, statusCode?: number): any;
22 status(response: any, statusCode: number): any;
23 end(response: any, message?: string): any;
24 render(response: any, view: string, options: any): any;
25 redirect(response: any, statusCode: number, url: string): any;
26 setErrorHandler(handler: Function, prefix?: string): any;
27 setNotFoundHandler(handler: Function, prefix?: string): any;
28 isHeadersSent(response: any): boolean;
29 getHeader?(response: any, name: string): any;
30 setHeader(response: any, name: string, value: string): any;
31 appendHeader?(response: any, name: string, value: string): any;
32 listen(port: string | number, callback?: () => void): Server;
33 listen(port: string | number, hostname: string, callback?: () => void): Server;
34 close(): Promise<unknown>;
35 set(...args: any[]): any;
36 enable(...args: any[]): any;
37 disable(...args: any[]): any;
38 engine(...args: any[]): any;
39 useStaticAssets(path: string, options: ServeStaticOptions): any;
40 setBaseViewsDir(path: string | string[]): any;
41 setViewEngine(engine: string): any;
42 getRequestHostname(request: any): string;
43 getRequestMethod(request: any): string;
44 getRequestUrl(request: any): string;
45 enableCors(options: CorsOptions | CorsOptionsDelegate<any>): any;
46 createMiddlewareFactory(requestMethod: RequestMethod): (path: string, callback: Function) => any;
47 initHttpServer(options: NestApplicationOptions): void;
48 registerParserMiddleware(prefix?: string, rawBody?: boolean): void;
49 useBodyParser<Options = NestExpressBodyParserOptions>(type: NestExpressBodyParserType, rawBody: boolean, options?: Omit<Options, 'verify'>): this;
50 setLocal(key: string, value: any): this;
51 getType(): string;
52 applyVersionFilter(handler: Function, version: VersionValue, versioningOptions: VersioningOptions): VersionedRoute;
53 private trackOpenConnections;
54 private closeOpenConnections;
55 private isMiddlewareApplied;
56}
57export {};