1 | import { RequestMethod } from '../../enums';
|
2 | import { CorsOptions, CorsOptionsDelegate } from '../../interfaces/external/cors-options.interface';
|
3 | import { NestApplicationOptions } from '../../interfaces/nest-application-options.interface';
|
4 | import { VersioningOptions, VersionValue } from '../version-options.interface';
|
5 | export type ErrorHandler<TRequest = any, TResponse = any> = (error: any, req: TRequest, res: TResponse, next?: Function) => any;
|
6 | export type RequestHandler<TRequest = any, TResponse = any> = (req: TRequest, res: TResponse, next?: Function) => any;
|
7 | export interface HttpServer<TRequest = any, TResponse = any, ServerInstance = any> {
|
8 | use(handler: RequestHandler<TRequest, TResponse> | ErrorHandler<TRequest, TResponse>): any;
|
9 | use(path: string, handler: RequestHandler<TRequest, TResponse> | ErrorHandler<TRequest, TResponse>): any;
|
10 | useBodyParser?(...args: any[]): any;
|
11 | get(handler: RequestHandler<TRequest, TResponse>): any;
|
12 | get(path: string, handler: RequestHandler<TRequest, TResponse>): any;
|
13 | post(handler: RequestHandler<TRequest, TResponse>): any;
|
14 | post(path: string, handler: RequestHandler<TRequest, TResponse>): any;
|
15 | head(handler: RequestHandler<TRequest, TResponse>): any;
|
16 | head(path: string, handler: RequestHandler<TRequest, TResponse>): any;
|
17 | delete(handler: RequestHandler<TRequest, TResponse>): any;
|
18 | delete(path: string, handler: RequestHandler<TRequest, TResponse>): any;
|
19 | put(handler: RequestHandler<TRequest, TResponse>): any;
|
20 | put(path: string, handler: RequestHandler<TRequest, TResponse>): any;
|
21 | patch(handler: RequestHandler<TRequest, TResponse>): any;
|
22 | patch(path: string, handler: RequestHandler<TRequest, TResponse>): any;
|
23 | all(path: string, handler: RequestHandler<TRequest, TResponse>): any;
|
24 | all(handler: RequestHandler<TRequest, TResponse>): any;
|
25 | options(handler: RequestHandler<TRequest, TResponse>): any;
|
26 | options(path: string, handler: RequestHandler<TRequest, TResponse>): any;
|
27 | search?(handler: RequestHandler<TRequest, TResponse>): any;
|
28 | search?(path: string, handler: RequestHandler<TRequest, TResponse>): any;
|
29 | listen(port: number | string, callback?: () => void): any;
|
30 | listen(port: number | string, hostname: string, callback?: () => void): any;
|
31 | reply(response: any, body: any, statusCode?: number): any;
|
32 | status(response: any, statusCode: number): any;
|
33 | end(response: any, message?: string): any;
|
34 | render(response: any, view: string, options: any): any;
|
35 | redirect(response: any, statusCode: number, url: string): any;
|
36 | isHeadersSent(response: any): boolean;
|
37 | setHeader(response: any, name: string, value: string): any;
|
38 | setErrorHandler?(handler: Function, prefix?: string): any;
|
39 | setNotFoundHandler?(handler: Function, prefix?: string): any;
|
40 | useStaticAssets?(...args: any[]): this;
|
41 | setBaseViewsDir?(path: string | string[]): this;
|
42 | setViewEngine?(engineOrOptions: any): this;
|
43 | createMiddlewareFactory(method: RequestMethod): ((path: string, callback: Function) => any) | Promise<(path: string, callback: Function) => any>;
|
44 | getRequestHostname?(request: TRequest): string;
|
45 | getRequestMethod?(request: TRequest): string;
|
46 | getRequestUrl?(request: TRequest): string;
|
47 | getInstance(): ServerInstance;
|
48 | registerParserMiddleware(...args: any[]): any;
|
49 | enableCors(options: CorsOptions | CorsOptionsDelegate<TRequest>): any;
|
50 | getHttpServer(): any;
|
51 | initHttpServer(options: NestApplicationOptions): void;
|
52 | close(): any;
|
53 | getType(): string;
|
54 | init?(): Promise<void>;
|
55 | applyVersionFilter(handler: Function, version: VersionValue, versioningOptions: VersioningOptions): (req: TRequest, res: TResponse, next: () => void) => Function;
|
56 | }
|