UNPKG

2.12 kBTypeScriptView Raw
1import { INestApplication } from '@nestjs/common';
2import { ServeStaticOptions } from './serve-static-options.interface';
3/**
4 * Interface describing methods on NestExpressApplication.
5 *
6 * @see [Platform](https://docs.nestjs.com/first-steps#platform)
7 *
8 * @publicApi
9 */
10export interface NestExpressApplication extends INestApplication {
11 /**
12 * A wrapper function around native `express.set()` method.
13 *
14 * @example
15 * app.set('trust proxy', 'loopback')
16 *
17 * @returns {this}
18 */
19 set(...args: any[]): this;
20 /**
21 * A wrapper function around native `express.engine()` method.
22 * @example
23 * app.engine('mustache', mustacheExpress())
24 *
25 * @returns {this}
26 */
27 engine(...args: any[]): this;
28 /**
29 * A wrapper function around native `express.enable()` method.
30 * @example
31 * app.enable('x-powered-by')
32 *
33 * @returns {this}
34 */
35 enable(...args: any[]): this;
36 /**
37 * A wrapper function around native `express.disable()` method.
38 *
39 * @example
40 * app.disable('x-powered-by')
41 *
42 * @returns {this}
43 */
44 disable(...args: any[]): this;
45 useStaticAssets(options: ServeStaticOptions): this;
46 /**
47 * Sets a base directory for public assets.
48 * @example
49 * app.useStaticAssets('public')
50 *
51 * @returns {this}
52 */
53 useStaticAssets(path: string, options?: ServeStaticOptions): this;
54 /**
55 * Sets one or multiple base directories for templates (views).
56 *
57 * @example
58 * app.setBaseViewsDir('views')
59 *
60 * @returns {this}
61 */
62 setBaseViewsDir(path: string | string[]): this;
63 /**
64 * Sets a view engine for templates (views).
65 * @example
66 * app.setViewEngine('pug')
67 *
68 * @returns {this}
69 */
70 setViewEngine(engine: string): this;
71 /**
72 * Sets app-level globals for view templates.
73 *
74 * @example
75 * app.setLocal('title', 'My Site')
76 *
77 * @see https://expressjs.com/en/4x/api.html#app.locals
78 *
79 * @returns {this}
80 */
81 setLocal(key: string, value: any): this;
82}