UNPKG

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