UNPKG

3.13 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 setHeader(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 {};