-
Notifications
You must be signed in to change notification settings - Fork 404
/
Copy pathRoutingControllersOptions.ts
111 lines (94 loc) · 3.11 KB
/
RoutingControllersOptions.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import { ClassTransformOptions } from 'class-transformer';
import { ValidatorOptions } from 'class-validator';
import { AuthorizationChecker } from './AuthorizationChecker';
import { CurrentUserChecker } from './CurrentUserChecker';
/**
* Routing controller initialization options.
*/
export interface RoutingControllersOptions {
/**
* Indicates if cors are enabled.
* This requires installation of additional module (cors for express and @koa/cors for koa).
*/
cors?: boolean | Object;
/**
* Global route prefix, for example '/api'.
*/
routePrefix?: string;
/**
* List of controllers to register in the framework or directories from where to import all your controllers.
*/
controllers?: Function[] | string[];
/**
* List of middlewares to register in the framework or directories from where to import all your middlewares.
*/
middlewares?: Function[] | string[];
/**
* List of interceptors to register in the framework or directories from where to import all your interceptors.
*/
interceptors?: Function[] | string[];
/**
* Indicates if class-transformer should be used to perform serialization / deserialization.
*/
classTransformer?: boolean;
/**
* Global class transformer options passed to class-transformer during classToPlain operation.
* This operation is being executed when server returns response to user.
*/
classToPlainTransformOptions?: ClassTransformOptions;
/**
* Global class transformer options passed to class-transformer during plainToClass operation.
* This operation is being executed when parsing user parameters.
*/
plainToClassTransformOptions?: ClassTransformOptions;
/**
* Indicates if class-validator should be used to auto validate objects injected into params.
* You can also directly pass validator options to enable validator with a given options.
*/
validation?: boolean | ValidatorOptions;
/**
* Indicates if development mode is enabled.
* By default its enabled if your NODE_ENV is not equal to "production".
*/
development?: boolean;
/**
* Indicates if default routing-controller's error handler is enabled or not.
* Enabled by default.
*/
defaultErrorHandler?: boolean;
/**
* Map of error overrides.
*/
errorOverridingMap?: { [key: string]: any };
/**
* Special function used to check user authorization roles per request.
* Must return true or promise with boolean true resolved for authorization to succeed.
*/
authorizationChecker?: AuthorizationChecker;
/**
* Special function used to get currently authorized user.
*/
currentUserChecker?: CurrentUserChecker;
/**
* Default settings
*/
defaults?: {
/**
* If set, all null responses will return specified status code by default
*/
nullResultCode?: number;
/**
* If set, all undefined responses will return specified status code by default
*/
undefinedResultCode?: number;
/**
* Default param options
*/
paramOptions?: {
/**
* If true, all non-set parameters will be required by default
*/
required?: boolean;
};
};
}