UNPKG

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