@moostjs/event-http 0.3.10 → 0.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +442 -691
- package/dist/index.d.ts +279 -329
- package/dist/index.mjs +441 -690
- package/package.json +5 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,329 +1,279 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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
|
-
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
*
|
|
168
|
-
* @
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Get
|
|
174
|
-
* @decorator
|
|
175
|
-
* @paramType
|
|
176
|
-
*/
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
*
|
|
181
|
-
* @
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
*
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
* }
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
* @
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
* @Controller()
|
|
281
|
-
* export class ExampleController {
|
|
282
|
-
* @Get('test')
|
|
283
|
-
* @SetStatus(201)
|
|
284
|
-
* testHandler() {
|
|
285
|
-
* return '...'
|
|
286
|
-
* }
|
|
287
|
-
* }
|
|
288
|
-
* ```
|
|
289
|
-
* @param code number
|
|
290
|
-
* @param opts optional { force?: boolean }
|
|
291
|
-
*/
|
|
292
|
-
export declare function SetStatus(...args: Parameters<typeof setStatusInterceptor>): ClassDecorator & MethodDecorator;
|
|
293
|
-
|
|
294
|
-
declare const setStatusInterceptor: (code: number, opts?: {
|
|
295
|
-
force?: boolean;
|
|
296
|
-
}) => TInterceptorFn;
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Hook to the Response Status
|
|
300
|
-
* @decorator
|
|
301
|
-
* @paramType TStatusHook
|
|
302
|
-
*/
|
|
303
|
-
export declare const StatusHook: () => ParameterDecorator & PropertyDecorator;
|
|
304
|
-
|
|
305
|
-
export declare type TCookieAttributes = Partial<TCookieAttributes_2>;
|
|
306
|
-
|
|
307
|
-
export { TCookieAttributesInput }
|
|
308
|
-
|
|
309
|
-
export declare type TCookieHook = THook & Partial<THook<TCookieAttributes, 'attrs'>>;
|
|
310
|
-
|
|
311
|
-
export declare type THeaderHook = THook;
|
|
312
|
-
|
|
313
|
-
export declare interface THttpHandlerMeta {
|
|
314
|
-
method: string;
|
|
315
|
-
path: string;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
export declare type TStatusHook = THook<number>;
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* Get Requested URL
|
|
322
|
-
* @decorator
|
|
323
|
-
* @paramType string
|
|
324
|
-
*/
|
|
325
|
-
export declare function Url(): ParameterDecorator & PropertyDecorator;
|
|
326
|
-
|
|
327
|
-
export { useHttpContext }
|
|
328
|
-
|
|
329
|
-
export { }
|
|
1
|
+
import * as _prostojs_logger from '@prostojs/logger';
|
|
2
|
+
import * as moost from 'moost';
|
|
3
|
+
import { TMoostAdapter, Moost, TMoostAdapterOptions, TInterceptorFn } from 'moost';
|
|
4
|
+
import * as http from 'http';
|
|
5
|
+
import { WooksHttp, TWooksHttpOptions, TCookieAttributes as TCookieAttributes$1, useSetCookies } from '@wooksjs/event-http';
|
|
6
|
+
export { HttpError, TCookieAttributesInput, useHttpContext } from '@wooksjs/event-http';
|
|
7
|
+
import { TProstoRouterPathBuilder } from '@prostojs/router';
|
|
8
|
+
import { THook } from '@wooksjs/event-core';
|
|
9
|
+
|
|
10
|
+
interface THttpHandlerMeta {
|
|
11
|
+
method: string;
|
|
12
|
+
path: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* ## Moost HTTP Adapter
|
|
16
|
+
*
|
|
17
|
+
* Moost Adapter for HTTP events
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* │ // HTTP server example
|
|
21
|
+
* │ import { MoostHttp, Get } from '@moostjs/event-http'
|
|
22
|
+
* │ import { Moost, Param } from 'moost'
|
|
23
|
+
* │
|
|
24
|
+
* │ class MyServer extends Moost {
|
|
25
|
+
* │ @Get('test/:name')
|
|
26
|
+
* │ test(@Param('name') name: string) {
|
|
27
|
+
* │ return { message: `Hello ${name}!` }
|
|
28
|
+
* │ }
|
|
29
|
+
* │ }
|
|
30
|
+
* │
|
|
31
|
+
* │ const app = new MyServer()
|
|
32
|
+
* │ const http = new MoostHttp()
|
|
33
|
+
* │ app.adapter(http).listen(3000, () => {
|
|
34
|
+
* │ app.getLogger('MyApp').log('Up on port 3000')
|
|
35
|
+
* │ })
|
|
36
|
+
* │ app.init()
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare class MoostHttp implements TMoostAdapter<THttpHandlerMeta> {
|
|
40
|
+
protected httpApp: WooksHttp;
|
|
41
|
+
constructor(httpApp?: WooksHttp | TWooksHttpOptions);
|
|
42
|
+
getHttpApp(): WooksHttp;
|
|
43
|
+
getServerCb(): (req: http.IncomingMessage, res: http.ServerResponse<http.IncomingMessage>) => Promise<void>;
|
|
44
|
+
listen(...args: Parameters<WooksHttp['listen']>): Promise<unknown>;
|
|
45
|
+
readonly pathBuilders: {
|
|
46
|
+
[id: string]: {
|
|
47
|
+
GET?: TProstoRouterPathBuilder<Record<string, string | string[]>>;
|
|
48
|
+
PUT?: TProstoRouterPathBuilder<Record<string, string | string[]>>;
|
|
49
|
+
PATCH?: TProstoRouterPathBuilder<Record<string, string | string[]>>;
|
|
50
|
+
POST?: TProstoRouterPathBuilder<Record<string, string | string[]>>;
|
|
51
|
+
DELETE?: TProstoRouterPathBuilder<Record<string, string | string[]>>;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
onNotFound(): Promise<{}>;
|
|
55
|
+
protected moost?: Moost;
|
|
56
|
+
onInit(moost: Moost): void;
|
|
57
|
+
getProvideRegistry(): moost.TProvideRegistry;
|
|
58
|
+
getLogger(): _prostojs_logger.TConsoleBase;
|
|
59
|
+
bindHandler<T extends object = object>(opts: TMoostAdapterOptions<THttpHandlerMeta, T>): void;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
declare function HttpMethod(method: '*' | 'GET' | 'PUT' | 'POST' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS', path?: string): MethodDecorator;
|
|
63
|
+
declare const All: (path?: string) => MethodDecorator;
|
|
64
|
+
declare const Get: (path?: string) => MethodDecorator;
|
|
65
|
+
declare const Post: (path?: string) => MethodDecorator;
|
|
66
|
+
declare const Put: (path?: string) => MethodDecorator;
|
|
67
|
+
declare const Delete: (path?: string) => MethodDecorator;
|
|
68
|
+
declare const Patch: (path?: string) => MethodDecorator;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Hook to the Response Status
|
|
72
|
+
* @decorator
|
|
73
|
+
* @paramType TStatusHook
|
|
74
|
+
*/
|
|
75
|
+
declare const StatusHook: () => ParameterDecorator & PropertyDecorator;
|
|
76
|
+
/**
|
|
77
|
+
* Hook to the Response Header
|
|
78
|
+
* @decorator
|
|
79
|
+
* @param name - header name
|
|
80
|
+
* @paramType THeaderHook
|
|
81
|
+
*/
|
|
82
|
+
declare const HeaderHook: (name: string) => ParameterDecorator & PropertyDecorator;
|
|
83
|
+
/**
|
|
84
|
+
* Hook to the Response Cookie
|
|
85
|
+
* @decorator
|
|
86
|
+
* @param name - cookie name
|
|
87
|
+
* @paramType TCookieHook
|
|
88
|
+
*/
|
|
89
|
+
declare const CookieHook: (name: string) => ParameterDecorator & PropertyDecorator;
|
|
90
|
+
/**
|
|
91
|
+
* Hook to the Response Cookie Attributes
|
|
92
|
+
* @decorator
|
|
93
|
+
* @param name - cookie name
|
|
94
|
+
* @paramType TCookieAttributes
|
|
95
|
+
*/
|
|
96
|
+
declare const CookieAttrsHook: (name: string) => ParameterDecorator & PropertyDecorator;
|
|
97
|
+
/**
|
|
98
|
+
* Parse Authorisation Header
|
|
99
|
+
* @decorator
|
|
100
|
+
* @param name - define what to take from the Auth header
|
|
101
|
+
* @paramType string
|
|
102
|
+
*/
|
|
103
|
+
declare function Authorization(name: 'username' | 'password' | 'bearer' | 'raw' | 'type'): ParameterDecorator & PropertyDecorator;
|
|
104
|
+
/**
|
|
105
|
+
* Get Request Header Value
|
|
106
|
+
* @decorator
|
|
107
|
+
* @param name - header name
|
|
108
|
+
* @paramType string
|
|
109
|
+
*/
|
|
110
|
+
declare function Header(name: string): ParameterDecorator & PropertyDecorator;
|
|
111
|
+
/**
|
|
112
|
+
* Get Request Cookie Value
|
|
113
|
+
* @decorator
|
|
114
|
+
* @param name - cookie name
|
|
115
|
+
* @paramType string
|
|
116
|
+
*/
|
|
117
|
+
declare function Cookie(name: string): ParameterDecorator & PropertyDecorator;
|
|
118
|
+
/**
|
|
119
|
+
* Get Query Item value or the whole parsed Query as an object
|
|
120
|
+
* @decorator
|
|
121
|
+
* @param name - query item name (optional)
|
|
122
|
+
* @paramType string | object
|
|
123
|
+
*/
|
|
124
|
+
declare function Query(name?: string): ParameterDecorator;
|
|
125
|
+
/**
|
|
126
|
+
* Get Requested URL
|
|
127
|
+
* @decorator
|
|
128
|
+
* @paramType string
|
|
129
|
+
*/
|
|
130
|
+
declare function Url(): ParameterDecorator & PropertyDecorator;
|
|
131
|
+
/**
|
|
132
|
+
* Get Requested HTTP Method
|
|
133
|
+
* @decorator
|
|
134
|
+
* @paramType string
|
|
135
|
+
*/
|
|
136
|
+
declare function Method(): ParameterDecorator & PropertyDecorator;
|
|
137
|
+
/**
|
|
138
|
+
* Get Raw Request Instance
|
|
139
|
+
* @decorator
|
|
140
|
+
* @paramType IncomingMessage
|
|
141
|
+
*/
|
|
142
|
+
declare function Req(): ParameterDecorator & PropertyDecorator;
|
|
143
|
+
/**
|
|
144
|
+
* Get Raw Response Instance
|
|
145
|
+
* @decorator
|
|
146
|
+
* @param opts (optional) { passthrough: boolean }
|
|
147
|
+
* @paramType ServerResponse
|
|
148
|
+
*/
|
|
149
|
+
declare function Res(opts?: {
|
|
150
|
+
passthrough: boolean;
|
|
151
|
+
}): ParameterDecorator & PropertyDecorator;
|
|
152
|
+
/**
|
|
153
|
+
* Get Request Unique Identificator (UUID)
|
|
154
|
+
* @decorator
|
|
155
|
+
* @paramType string
|
|
156
|
+
*/
|
|
157
|
+
declare function ReqId(): ParameterDecorator & PropertyDecorator;
|
|
158
|
+
/**
|
|
159
|
+
* Get Request IP Address
|
|
160
|
+
* @decorator
|
|
161
|
+
* @paramType string
|
|
162
|
+
*/
|
|
163
|
+
declare function Ip(opts?: {
|
|
164
|
+
trustProxy: boolean;
|
|
165
|
+
}): ParameterDecorator & PropertyDecorator;
|
|
166
|
+
/**
|
|
167
|
+
* Get Request IP Address list
|
|
168
|
+
* @decorator
|
|
169
|
+
* @paramType string[]
|
|
170
|
+
*/
|
|
171
|
+
declare function IpList(): ParameterDecorator & PropertyDecorator;
|
|
172
|
+
/**
|
|
173
|
+
* Get Parsed Request Body
|
|
174
|
+
* @decorator
|
|
175
|
+
* @paramType object | string | unknown
|
|
176
|
+
*/
|
|
177
|
+
declare function Body(): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
178
|
+
/**
|
|
179
|
+
* Get Raw Request Body Buffer
|
|
180
|
+
* @decorator
|
|
181
|
+
* @paramType Promise<Buffer>
|
|
182
|
+
*/
|
|
183
|
+
declare function RawBody(): ParameterDecorator & PropertyDecorator;
|
|
184
|
+
type TStatusHook = THook<number>;
|
|
185
|
+
type THeaderHook = THook;
|
|
186
|
+
type TCookieAttributes = Partial<TCookieAttributes$1>;
|
|
187
|
+
type TCookieHook = THook & Partial<THook<TCookieAttributes, 'attrs'>>;
|
|
188
|
+
|
|
189
|
+
declare const setHeaderInterceptor: (name: string, value: string, opts?: {
|
|
190
|
+
force?: boolean;
|
|
191
|
+
status?: number;
|
|
192
|
+
when?: 'always' | 'error' | 'ok';
|
|
193
|
+
}) => TInterceptorFn;
|
|
194
|
+
/**
|
|
195
|
+
* Set Header for Request Handler
|
|
196
|
+
*
|
|
197
|
+
* ```ts
|
|
198
|
+
* import { Get, SetHeader } from '@moostjs/event-http';
|
|
199
|
+
* import { Controller } from 'moost';
|
|
200
|
+
*
|
|
201
|
+
* @Controller()
|
|
202
|
+
* export class ExampleController {
|
|
203
|
+
* @Get('test')
|
|
204
|
+
* // setting header for request handler
|
|
205
|
+
* @SetHeader('x-server', 'my-server')
|
|
206
|
+
* testHandler() {
|
|
207
|
+
* return '...'
|
|
208
|
+
* }
|
|
209
|
+
* }
|
|
210
|
+
* ```
|
|
211
|
+
*
|
|
212
|
+
* ```ts
|
|
213
|
+
* import { Get, SetHeader } from '@moostjs/event-http';
|
|
214
|
+
* import { Controller } from 'moost';
|
|
215
|
+
*
|
|
216
|
+
* @Controller()
|
|
217
|
+
* export class ExampleController {
|
|
218
|
+
* @Get('test')
|
|
219
|
+
* // setting header only if status = 400
|
|
220
|
+
* @SetHeader('content-type', 'text/plain', { status: 400 })
|
|
221
|
+
* testHandler() {
|
|
222
|
+
* return '...'
|
|
223
|
+
* }
|
|
224
|
+
* }
|
|
225
|
+
* ```
|
|
226
|
+
*
|
|
227
|
+
* @param name name of header
|
|
228
|
+
* @param value value for header
|
|
229
|
+
* @param options options { status?: number, force?: boolean }
|
|
230
|
+
*/
|
|
231
|
+
declare function SetHeader(...args: Parameters<typeof setHeaderInterceptor>): ClassDecorator & MethodDecorator;
|
|
232
|
+
declare const setCookieInterceptor: (...args: Parameters<ReturnType<typeof useSetCookies>['setCookie']>) => TInterceptorFn;
|
|
233
|
+
/**
|
|
234
|
+
* Set Cookie for Request Handler
|
|
235
|
+
* ```ts
|
|
236
|
+
* import { Get, SetCookie } from '@moostjs/event-http';
|
|
237
|
+
* import { Controller } from 'moost';
|
|
238
|
+
*
|
|
239
|
+
* @Controller()
|
|
240
|
+
* export class ExampleController {
|
|
241
|
+
* @Get('test')
|
|
242
|
+
* // setting 'my-cookie' = 'value' with maxAge of 10 minutes
|
|
243
|
+
* @SetCookie('my-cookie', 'value', { maxAge: '10m' })
|
|
244
|
+
* testHandler() {
|
|
245
|
+
* return '...'
|
|
246
|
+
* }
|
|
247
|
+
* }
|
|
248
|
+
* ```
|
|
249
|
+
*
|
|
250
|
+
* @param name name of cookie
|
|
251
|
+
* @param value value for cookie
|
|
252
|
+
* @param attrs cookie attributes
|
|
253
|
+
*/
|
|
254
|
+
declare function SetCookie(...args: Parameters<typeof setCookieInterceptor>): ClassDecorator & MethodDecorator;
|
|
255
|
+
declare const setStatusInterceptor: (code: number, opts?: {
|
|
256
|
+
force?: boolean;
|
|
257
|
+
}) => TInterceptorFn;
|
|
258
|
+
/**
|
|
259
|
+
* Set Response Status for Request Handler
|
|
260
|
+
*
|
|
261
|
+
* ```ts
|
|
262
|
+
* import { Get, SetStatus } from '@moostjs/event-http';
|
|
263
|
+
* import { Controller } from 'moost';
|
|
264
|
+
*
|
|
265
|
+
* @Controller()
|
|
266
|
+
* export class ExampleController {
|
|
267
|
+
* @Get('test')
|
|
268
|
+
* @SetStatus(201)
|
|
269
|
+
* testHandler() {
|
|
270
|
+
* return '...'
|
|
271
|
+
* }
|
|
272
|
+
* }
|
|
273
|
+
* ```
|
|
274
|
+
* @param code number
|
|
275
|
+
* @param opts optional { force?: boolean }
|
|
276
|
+
*/
|
|
277
|
+
declare function SetStatus(...args: Parameters<typeof setStatusInterceptor>): ClassDecorator & MethodDecorator;
|
|
278
|
+
|
|
279
|
+
export { All, Authorization, Body, Cookie, CookieAttrsHook, CookieHook, Delete, Get, Header, HeaderHook, HttpMethod, Ip, IpList, Method, MoostHttp, Patch, Post, Put, Query, RawBody, Req, ReqId, Res, SetCookie, SetHeader, SetStatus, StatusHook, type TCookieAttributes, type TCookieHook, type THeaderHook, type THttpHandlerMeta, type TStatusHook, Url };
|