UNPKG

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