@xylabs/express 4.13.20 → 4.13.21
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/README.md +1839 -3
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -12,13 +12,1849 @@
|
|
|
12
12
|
[![snyk-badge][]][snyk-link]
|
|
13
13
|
[![socket-badge][]][socket-link]
|
|
14
14
|
|
|
15
|
-
Version: 4.13.19
|
|
16
15
|
|
|
17
16
|
SDK for base code for Api repos that use express and deploy on AWS ECS
|
|
18
17
|
|
|
19
|
-
## Documentation
|
|
18
|
+
## API Documentation
|
|
19
|
+
|
|
20
|
+
**@xylabs/express**
|
|
21
|
+
|
|
22
|
+
***
|
|
23
|
+
|
|
24
|
+
## Classes
|
|
25
|
+
|
|
26
|
+
- [WrappedWinstonLogger](#classes/WrappedWinstonLogger)
|
|
27
|
+
- [Counters](#classes/Counters)
|
|
28
|
+
- [Profiler](#classes/Profiler)
|
|
29
|
+
|
|
30
|
+
## Interfaces
|
|
31
|
+
|
|
32
|
+
- [Empty](#interfaces/Empty)
|
|
33
|
+
- [LoggerOptions](#interfaces/LoggerOptions)
|
|
34
|
+
- [ExpressError](#interfaces/ExpressError)
|
|
35
|
+
- [Source](#interfaces/Source)
|
|
36
|
+
- [ApiError](#interfaces/ApiError)
|
|
37
|
+
- [HrefWithMeta](#interfaces/HrefWithMeta)
|
|
38
|
+
- [IRelationshipSelfLink](#interfaces/IRelationshipSelfLink)
|
|
39
|
+
- [IRelationshipRelatedLink](#interfaces/IRelationshipRelatedLink)
|
|
40
|
+
- [IRelationshipLinks](#interfaces/IRelationshipLinks)
|
|
41
|
+
- [IRelationshipData](#interfaces/IRelationshipData)
|
|
42
|
+
- [ApiResourceIdentifierObject](#interfaces/ApiResourceIdentifierObject)
|
|
43
|
+
- [ApiResourceObject](#interfaces/ApiResourceObject)
|
|
44
|
+
- [JsonApi](#interfaces/JsonApi)
|
|
45
|
+
- [ApiResponseBase](#interfaces/ApiResponseBase)
|
|
46
|
+
- [ApiDataResponse](#interfaces/ApiDataResponse)
|
|
47
|
+
- [ApiErrorResponse](#interfaces/ApiErrorResponse)
|
|
48
|
+
|
|
49
|
+
## Type Aliases
|
|
50
|
+
|
|
51
|
+
- [NoReqParams](#type-aliases/NoReqParams)
|
|
52
|
+
- [NoResBody](#type-aliases/NoResBody)
|
|
53
|
+
- [NoReqBody](#type-aliases/NoReqBody)
|
|
54
|
+
- [NoReqQuery](#type-aliases/NoReqQuery)
|
|
55
|
+
- [NoLocals](#type-aliases/NoLocals)
|
|
56
|
+
- [LoggerMeta](#type-aliases/LoggerMeta)
|
|
57
|
+
- [LoggerVerbosity](#type-aliases/LoggerVerbosity)
|
|
58
|
+
- [~~LogFunction~~](#type-aliases/LogFunction)
|
|
59
|
+
- [~~Logger~~](#type-aliases/Logger)
|
|
60
|
+
- [ParseFunc](#type-aliases/ParseFunc)
|
|
61
|
+
- [ApiLink](#type-aliases/ApiLink)
|
|
62
|
+
- [ApiLinks](#type-aliases/ApiLinks)
|
|
63
|
+
- [ResourceLinkage](#type-aliases/ResourceLinkage)
|
|
64
|
+
- [RelationshipMeta](#type-aliases/RelationshipMeta)
|
|
65
|
+
- [Relationship](#type-aliases/Relationship)
|
|
66
|
+
- [ApiResponse](#type-aliases/ApiResponse)
|
|
67
|
+
|
|
68
|
+
## Variables
|
|
69
|
+
|
|
70
|
+
- [notImplemented](#variables/notImplemented)
|
|
71
|
+
- [DefaultJsonBodyParserOptionsLimit](#variables/DefaultJsonBodyParserOptionsLimit)
|
|
72
|
+
- [DefaultJsonBodyParserOptionsTypes](#variables/DefaultJsonBodyParserOptionsTypes)
|
|
73
|
+
- [DefaultJsonBodyParserOptions](#variables/DefaultJsonBodyParserOptions)
|
|
74
|
+
- [jsonBodyParser](#variables/jsonBodyParser)
|
|
75
|
+
- [standardResponses](#variables/standardResponses)
|
|
76
|
+
|
|
77
|
+
## Functions
|
|
78
|
+
|
|
79
|
+
- [asyncHandler](#functions/asyncHandler)
|
|
80
|
+
- [errorToJsonHandler](#functions/errorToJsonHandler)
|
|
81
|
+
- [getHttpHeader](#functions/getHttpHeader)
|
|
82
|
+
- [getDefaultLogger](#functions/getDefaultLogger)
|
|
83
|
+
- [getLogger](#functions/getLogger)
|
|
84
|
+
- [compactObject](#functions/compactObject)
|
|
85
|
+
- [tryParse](#functions/tryParse)
|
|
86
|
+
- [tryParseFloat](#functions/tryParseFloat)
|
|
87
|
+
- [tryParseInt](#functions/tryParseInt)
|
|
88
|
+
- [enableCaseSensitiveRouting](#functions/enableCaseSensitiveRouting)
|
|
89
|
+
- [disableCaseSensitiveRouting](#functions/disableCaseSensitiveRouting)
|
|
90
|
+
- [enableExpressDefaultPoweredByHeader](#functions/enableExpressDefaultPoweredByHeader)
|
|
91
|
+
- [disableExpressDefaultPoweredByHeader](#functions/disableExpressDefaultPoweredByHeader)
|
|
92
|
+
- [customPoweredByHeader](#functions/customPoweredByHeader)
|
|
93
|
+
- [getJsonBodyParserOptions](#functions/getJsonBodyParserOptions)
|
|
94
|
+
- [getJsonBodyParser](#functions/getJsonBodyParser)
|
|
95
|
+
- [useRequestCounters](#functions/useRequestCounters)
|
|
96
|
+
- [responseProfiler](#functions/responseProfiler)
|
|
97
|
+
- [getResponseMetadata](#functions/getResponseMetadata)
|
|
98
|
+
- [standardErrors](#functions/standardErrors)
|
|
99
|
+
- [setRawResponseFormat](#functions/setRawResponseFormat)
|
|
100
|
+
- [clearRawResponseFormat](#functions/clearRawResponseFormat)
|
|
101
|
+
- [isRawResponseFormatSet](#functions/isRawResponseFormatSet)
|
|
102
|
+
|
|
103
|
+
### classes
|
|
104
|
+
|
|
105
|
+
### <a id="Counters"></a>Counters
|
|
106
|
+
|
|
107
|
+
[**@xylabs/express**](#../README)
|
|
108
|
+
|
|
109
|
+
***
|
|
110
|
+
|
|
111
|
+
## Constructors
|
|
112
|
+
|
|
113
|
+
### Constructor
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
new Counters(): Counters;
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Returns
|
|
120
|
+
|
|
121
|
+
`Counters`
|
|
122
|
+
|
|
123
|
+
## Properties
|
|
124
|
+
|
|
125
|
+
### counters
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
static counters: Record<string, number> = {};
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Methods
|
|
132
|
+
|
|
133
|
+
### inc()
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
static inc(name, count): void;
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Parameters
|
|
140
|
+
|
|
141
|
+
#### name
|
|
142
|
+
|
|
143
|
+
`string`
|
|
144
|
+
|
|
145
|
+
#### count
|
|
146
|
+
|
|
147
|
+
`number` = `1`
|
|
148
|
+
|
|
149
|
+
### Returns
|
|
150
|
+
|
|
151
|
+
`void`
|
|
152
|
+
|
|
153
|
+
***
|
|
154
|
+
|
|
155
|
+
### max()
|
|
156
|
+
|
|
157
|
+
```ts
|
|
158
|
+
static max(name, count): void;
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Parameters
|
|
162
|
+
|
|
163
|
+
#### name
|
|
164
|
+
|
|
165
|
+
`string`
|
|
166
|
+
|
|
167
|
+
#### count
|
|
168
|
+
|
|
169
|
+
`number`
|
|
170
|
+
|
|
171
|
+
### Returns
|
|
172
|
+
|
|
173
|
+
`void`
|
|
174
|
+
|
|
175
|
+
***
|
|
176
|
+
|
|
177
|
+
### min()
|
|
178
|
+
|
|
179
|
+
```ts
|
|
180
|
+
static min(name, count): void;
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Parameters
|
|
184
|
+
|
|
185
|
+
#### name
|
|
186
|
+
|
|
187
|
+
`string`
|
|
188
|
+
|
|
189
|
+
#### count
|
|
190
|
+
|
|
191
|
+
`number`
|
|
192
|
+
|
|
193
|
+
### Returns
|
|
194
|
+
|
|
195
|
+
`void`
|
|
196
|
+
|
|
197
|
+
### <a id="Profiler"></a>Profiler
|
|
198
|
+
|
|
199
|
+
[**@xylabs/express**](#../README)
|
|
200
|
+
|
|
201
|
+
***
|
|
202
|
+
|
|
203
|
+
## Constructors
|
|
204
|
+
|
|
205
|
+
### Constructor
|
|
206
|
+
|
|
207
|
+
```ts
|
|
208
|
+
new Profiler(): Profiler;
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Returns
|
|
212
|
+
|
|
213
|
+
`Profiler`
|
|
214
|
+
|
|
215
|
+
## Properties
|
|
216
|
+
|
|
217
|
+
### stats
|
|
218
|
+
|
|
219
|
+
```ts
|
|
220
|
+
stats: Record<string, number> = {};
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Methods
|
|
224
|
+
|
|
225
|
+
### profile()
|
|
226
|
+
|
|
227
|
+
```ts
|
|
228
|
+
profile<T>(name, promise): Promise<T>;
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Type Parameters
|
|
232
|
+
|
|
233
|
+
#### T
|
|
234
|
+
|
|
235
|
+
`T`
|
|
236
|
+
|
|
237
|
+
### Parameters
|
|
238
|
+
|
|
239
|
+
#### name
|
|
240
|
+
|
|
241
|
+
`string`
|
|
242
|
+
|
|
243
|
+
#### promise
|
|
244
|
+
|
|
245
|
+
`Promise`\<`T`\>
|
|
246
|
+
|
|
247
|
+
### Returns
|
|
248
|
+
|
|
249
|
+
`Promise`\<`T`\>
|
|
250
|
+
|
|
251
|
+
### <a id="WrappedWinstonLogger"></a>WrappedWinstonLogger
|
|
252
|
+
|
|
253
|
+
[**@xylabs/express**](#../README)
|
|
254
|
+
|
|
255
|
+
***
|
|
256
|
+
|
|
257
|
+
Wrap Winston logger methods to adapt to familiar
|
|
258
|
+
console logging methods
|
|
259
|
+
|
|
260
|
+
## Implements
|
|
261
|
+
|
|
262
|
+
- `Logger`
|
|
263
|
+
|
|
264
|
+
## Constructors
|
|
265
|
+
|
|
266
|
+
### Constructor
|
|
267
|
+
|
|
268
|
+
```ts
|
|
269
|
+
new WrappedWinstonLogger(winston): WrappedWinstonLogger;
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Parameters
|
|
273
|
+
|
|
274
|
+
#### winston
|
|
275
|
+
|
|
276
|
+
`Logger`
|
|
277
|
+
|
|
278
|
+
### Returns
|
|
279
|
+
|
|
280
|
+
`WrappedWinstonLogger`
|
|
281
|
+
|
|
282
|
+
## Properties
|
|
283
|
+
|
|
284
|
+
### winston
|
|
285
|
+
|
|
286
|
+
```ts
|
|
287
|
+
protected readonly winston: Logger;
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
***
|
|
291
|
+
|
|
292
|
+
### debug
|
|
293
|
+
|
|
294
|
+
```ts
|
|
295
|
+
debug: LogFunction;
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### Implementation of
|
|
299
|
+
|
|
300
|
+
```ts
|
|
301
|
+
Logger.debug
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
***
|
|
305
|
+
|
|
306
|
+
### error
|
|
307
|
+
|
|
308
|
+
```ts
|
|
309
|
+
error: LogFunction;
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### Implementation of
|
|
313
|
+
|
|
314
|
+
```ts
|
|
315
|
+
Logger.error
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
***
|
|
319
|
+
|
|
320
|
+
### info
|
|
321
|
+
|
|
322
|
+
```ts
|
|
323
|
+
info: LogFunction;
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### Implementation of
|
|
327
|
+
|
|
328
|
+
```ts
|
|
329
|
+
Logger.info
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
***
|
|
333
|
+
|
|
334
|
+
### log
|
|
335
|
+
|
|
336
|
+
```ts
|
|
337
|
+
log: LogFunction;
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### Implementation of
|
|
341
|
+
|
|
342
|
+
```ts
|
|
343
|
+
Logger.log
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
***
|
|
347
|
+
|
|
348
|
+
### trace
|
|
349
|
+
|
|
350
|
+
```ts
|
|
351
|
+
trace: LogFunction;
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
### Implementation of
|
|
355
|
+
|
|
356
|
+
```ts
|
|
357
|
+
Logger.trace
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
***
|
|
361
|
+
|
|
362
|
+
### warn
|
|
363
|
+
|
|
364
|
+
```ts
|
|
365
|
+
warn: LogFunction;
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
### Implementation of
|
|
369
|
+
|
|
370
|
+
```ts
|
|
371
|
+
Logger.warn
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### functions
|
|
375
|
+
|
|
376
|
+
### <a id="asyncHandler"></a>asyncHandler
|
|
377
|
+
|
|
378
|
+
[**@xylabs/express**](#../README)
|
|
379
|
+
|
|
380
|
+
***
|
|
381
|
+
|
|
382
|
+
```ts
|
|
383
|
+
function asyncHandler<P, ResBody, ReqBody, ReqQuery, Locals>(fn): (req, res, next) => Promise<void>;
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
## Type Parameters
|
|
387
|
+
|
|
388
|
+
### P
|
|
389
|
+
|
|
390
|
+
`P` = `ParamsDictionary`
|
|
391
|
+
|
|
392
|
+
### ResBody
|
|
393
|
+
|
|
394
|
+
`ResBody` = [`Empty`](#../interfaces/Empty)
|
|
395
|
+
|
|
396
|
+
### ReqBody
|
|
397
|
+
|
|
398
|
+
`ReqBody` = [`Empty`](#../interfaces/Empty)
|
|
399
|
+
|
|
400
|
+
### ReqQuery
|
|
401
|
+
|
|
402
|
+
`ReqQuery` = `ParsedQs`
|
|
403
|
+
|
|
404
|
+
### Locals
|
|
405
|
+
|
|
406
|
+
`Locals` *extends* [`NoLocals`](#../type-aliases/NoLocals) = [`NoLocals`](#../type-aliases/NoLocals)
|
|
407
|
+
|
|
408
|
+
## Parameters
|
|
409
|
+
|
|
410
|
+
### fn
|
|
411
|
+
|
|
412
|
+
`RequestHandler`\<`P`, `ResBody`, `ReqBody`, `ReqQuery`, `Locals`\>
|
|
413
|
+
|
|
414
|
+
## Returns
|
|
415
|
+
|
|
416
|
+
```ts
|
|
417
|
+
(
|
|
418
|
+
req,
|
|
419
|
+
res,
|
|
420
|
+
next): Promise<void>;
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
### Parameters
|
|
424
|
+
|
|
425
|
+
### req
|
|
426
|
+
|
|
427
|
+
`Request`\<`P`, `ResBody`, `ReqBody`, `ReqQuery`, `Locals`\>
|
|
428
|
+
|
|
429
|
+
### res
|
|
430
|
+
|
|
431
|
+
`Response`\<`ResBody`, `Locals`\>
|
|
432
|
+
|
|
433
|
+
### next
|
|
434
|
+
|
|
435
|
+
`NextFunction`
|
|
436
|
+
|
|
437
|
+
### Returns
|
|
438
|
+
|
|
439
|
+
`Promise`\<`void`\>
|
|
440
|
+
|
|
441
|
+
### <a id="clearRawResponseFormat"></a>clearRawResponseFormat
|
|
442
|
+
|
|
443
|
+
[**@xylabs/express**](#../README)
|
|
444
|
+
|
|
445
|
+
***
|
|
446
|
+
|
|
447
|
+
```ts
|
|
448
|
+
function clearRawResponseFormat(res): void;
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
Clears any flags on the response, allowing the response to
|
|
452
|
+
use the default standard response envelope
|
|
453
|
+
|
|
454
|
+
## Parameters
|
|
455
|
+
|
|
456
|
+
### res
|
|
457
|
+
|
|
458
|
+
`Response`
|
|
459
|
+
|
|
460
|
+
The response to set to the standard response format
|
|
461
|
+
|
|
462
|
+
## Returns
|
|
463
|
+
|
|
464
|
+
`void`
|
|
465
|
+
|
|
466
|
+
### <a id="compactObject"></a>compactObject
|
|
467
|
+
|
|
468
|
+
[**@xylabs/express**](#../README)
|
|
469
|
+
|
|
470
|
+
***
|
|
471
|
+
|
|
472
|
+
```ts
|
|
473
|
+
function compactObject<T>(obj): T;
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
## Type Parameters
|
|
477
|
+
|
|
478
|
+
### T
|
|
479
|
+
|
|
480
|
+
`T` *extends* `Record`\<`string`, `unknown`\>
|
|
481
|
+
|
|
482
|
+
## Parameters
|
|
483
|
+
|
|
484
|
+
### obj
|
|
485
|
+
|
|
486
|
+
`T`
|
|
487
|
+
|
|
488
|
+
## Returns
|
|
489
|
+
|
|
490
|
+
`T`
|
|
491
|
+
|
|
492
|
+
### <a id="customPoweredByHeader"></a>customPoweredByHeader
|
|
493
|
+
|
|
494
|
+
[**@xylabs/express**](#../README)
|
|
495
|
+
|
|
496
|
+
***
|
|
497
|
+
|
|
498
|
+
```ts
|
|
499
|
+
function customPoweredByHeader(
|
|
500
|
+
req,
|
|
501
|
+
res,
|
|
502
|
+
next): void;
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
## Parameters
|
|
506
|
+
|
|
507
|
+
### req
|
|
508
|
+
|
|
509
|
+
`Request`
|
|
510
|
+
|
|
511
|
+
### res
|
|
512
|
+
|
|
513
|
+
`Response`
|
|
514
|
+
|
|
515
|
+
### next
|
|
516
|
+
|
|
517
|
+
`NextFunction`
|
|
518
|
+
|
|
519
|
+
## Returns
|
|
520
|
+
|
|
521
|
+
`void`
|
|
522
|
+
|
|
523
|
+
### <a id="disableCaseSensitiveRouting"></a>disableCaseSensitiveRouting
|
|
524
|
+
|
|
525
|
+
[**@xylabs/express**](#../README)
|
|
526
|
+
|
|
527
|
+
***
|
|
528
|
+
|
|
529
|
+
```ts
|
|
530
|
+
function disableCaseSensitiveRouting(app): void;
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
Disable case sensitivity. When enabled, "/Foo" and "/foo" are different
|
|
534
|
+
routes. When disabled, "/Foo" and "/foo" are treated the same.
|
|
535
|
+
|
|
536
|
+
## Parameters
|
|
537
|
+
|
|
538
|
+
### app
|
|
539
|
+
|
|
540
|
+
`Express`
|
|
541
|
+
|
|
542
|
+
The Express app to disable the header on.
|
|
543
|
+
|
|
544
|
+
## Returns
|
|
545
|
+
|
|
546
|
+
`void`
|
|
547
|
+
|
|
548
|
+
### <a id="disableExpressDefaultPoweredByHeader"></a>disableExpressDefaultPoweredByHeader
|
|
549
|
+
|
|
550
|
+
[**@xylabs/express**](#../README)
|
|
551
|
+
|
|
552
|
+
***
|
|
553
|
+
|
|
554
|
+
```ts
|
|
555
|
+
function disableExpressDefaultPoweredByHeader(app): void;
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
By default Express appends the `X-Powered-By: Express` header to
|
|
559
|
+
all responses. Calling this method disables that behavior.
|
|
560
|
+
|
|
561
|
+
## Parameters
|
|
562
|
+
|
|
563
|
+
### app
|
|
564
|
+
|
|
565
|
+
`Express`
|
|
566
|
+
|
|
567
|
+
The Express app to disable the header on.
|
|
568
|
+
|
|
569
|
+
## Returns
|
|
570
|
+
|
|
571
|
+
`void`
|
|
572
|
+
|
|
573
|
+
### <a id="enableCaseSensitiveRouting"></a>enableCaseSensitiveRouting
|
|
574
|
+
|
|
575
|
+
[**@xylabs/express**](#../README)
|
|
576
|
+
|
|
577
|
+
***
|
|
578
|
+
|
|
579
|
+
```ts
|
|
580
|
+
function enableCaseSensitiveRouting(app): void;
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
Enable case sensitivity. When enabled, "/Foo" and "/foo" are different
|
|
584
|
+
routes. When disabled, "/Foo" and "/foo" are treated the same.
|
|
585
|
+
|
|
586
|
+
## Parameters
|
|
587
|
+
|
|
588
|
+
### app
|
|
589
|
+
|
|
590
|
+
`Express`
|
|
591
|
+
|
|
592
|
+
The Express app to disable the header on.
|
|
593
|
+
|
|
594
|
+
## Returns
|
|
595
|
+
|
|
596
|
+
`void`
|
|
597
|
+
|
|
598
|
+
### <a id="enableExpressDefaultPoweredByHeader"></a>enableExpressDefaultPoweredByHeader
|
|
599
|
+
|
|
600
|
+
[**@xylabs/express**](#../README)
|
|
601
|
+
|
|
602
|
+
***
|
|
603
|
+
|
|
604
|
+
```ts
|
|
605
|
+
function enableExpressDefaultPoweredByHeader(app): void;
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
By default Express appends the `X-Powered-By: Express` header to
|
|
609
|
+
all responses. Calling this method enables that behavior.
|
|
610
|
+
|
|
611
|
+
## Parameters
|
|
612
|
+
|
|
613
|
+
### app
|
|
614
|
+
|
|
615
|
+
`Express`
|
|
616
|
+
|
|
617
|
+
The Express app to disable the header on.
|
|
618
|
+
|
|
619
|
+
## Returns
|
|
620
|
+
|
|
621
|
+
`void`
|
|
622
|
+
|
|
623
|
+
### <a id="errorToJsonHandler"></a>errorToJsonHandler
|
|
624
|
+
|
|
625
|
+
[**@xylabs/express**](#../README)
|
|
626
|
+
|
|
627
|
+
***
|
|
628
|
+
|
|
629
|
+
```ts
|
|
630
|
+
function errorToJsonHandler(
|
|
631
|
+
error,
|
|
632
|
+
req,
|
|
633
|
+
res,
|
|
634
|
+
next): void;
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
## Parameters
|
|
638
|
+
|
|
639
|
+
### error
|
|
640
|
+
|
|
641
|
+
[`ExpressError`](#../interfaces/ExpressError)
|
|
642
|
+
|
|
643
|
+
### req
|
|
644
|
+
|
|
645
|
+
`Request`
|
|
646
|
+
|
|
647
|
+
### res
|
|
648
|
+
|
|
649
|
+
`Response`
|
|
650
|
+
|
|
651
|
+
### next
|
|
652
|
+
|
|
653
|
+
`NextFunction`
|
|
654
|
+
|
|
655
|
+
## Returns
|
|
656
|
+
|
|
657
|
+
`void`
|
|
658
|
+
|
|
659
|
+
### <a id="getDefaultLogger"></a>getDefaultLogger
|
|
660
|
+
|
|
661
|
+
[**@xylabs/express**](#../README)
|
|
662
|
+
|
|
663
|
+
***
|
|
664
|
+
|
|
665
|
+
```ts
|
|
666
|
+
function getDefaultLogger(): Logger;
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
## Returns
|
|
670
|
+
|
|
671
|
+
`Logger`
|
|
672
|
+
|
|
673
|
+
### <a id="getHttpHeader"></a>getHttpHeader
|
|
674
|
+
|
|
675
|
+
[**@xylabs/express**](#../README)
|
|
676
|
+
|
|
677
|
+
***
|
|
678
|
+
|
|
679
|
+
```ts
|
|
680
|
+
function getHttpHeader(header, req): undefined | string;
|
|
681
|
+
```
|
|
682
|
+
|
|
683
|
+
Since there can be multiple of certain HTTP headers or
|
|
684
|
+
to prevent ugliness if someone did send us multiple
|
|
685
|
+
instances of a header we only expect one of, this
|
|
686
|
+
method grabs the 1st/only one of the desired header
|
|
687
|
+
|
|
688
|
+
## Parameters
|
|
689
|
+
|
|
690
|
+
### header
|
|
691
|
+
|
|
692
|
+
`string`
|
|
693
|
+
|
|
694
|
+
The header to find
|
|
695
|
+
|
|
696
|
+
### req
|
|
697
|
+
|
|
698
|
+
`Request`
|
|
699
|
+
|
|
700
|
+
The received HTTP request (with headers)
|
|
701
|
+
|
|
702
|
+
## Returns
|
|
703
|
+
|
|
704
|
+
`undefined` \| `string`
|
|
705
|
+
|
|
706
|
+
The first or only occurrence of the specified HTTP header
|
|
707
|
+
|
|
708
|
+
### <a id="getJsonBodyParser"></a>getJsonBodyParser
|
|
709
|
+
|
|
710
|
+
[**@xylabs/express**](#../README)
|
|
711
|
+
|
|
712
|
+
***
|
|
713
|
+
|
|
714
|
+
```ts
|
|
715
|
+
function getJsonBodyParser(options): NextHandleFunction;
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
Get a JSON Body Parser connect middleware handler
|
|
719
|
+
|
|
720
|
+
## Parameters
|
|
721
|
+
|
|
722
|
+
### options
|
|
723
|
+
|
|
724
|
+
`OptionsJson` = `DefaultJsonBodyParserOptions`
|
|
725
|
+
|
|
726
|
+
The options for the JSON Body Parser
|
|
727
|
+
|
|
728
|
+
## Returns
|
|
729
|
+
|
|
730
|
+
`NextHandleFunction`
|
|
731
|
+
|
|
732
|
+
A middleware function that parses JSON bodies
|
|
733
|
+
|
|
734
|
+
### <a id="getJsonBodyParserOptions"></a>getJsonBodyParserOptions
|
|
735
|
+
|
|
736
|
+
[**@xylabs/express**](#../README)
|
|
737
|
+
|
|
738
|
+
***
|
|
739
|
+
|
|
740
|
+
```ts
|
|
741
|
+
function getJsonBodyParserOptions(options?): OptionsJson;
|
|
742
|
+
```
|
|
743
|
+
|
|
744
|
+
Gets the default JSON Body Parser options merged with the supplied options
|
|
745
|
+
with the supplied options taking precedence
|
|
746
|
+
|
|
747
|
+
## Parameters
|
|
748
|
+
|
|
749
|
+
### options?
|
|
750
|
+
|
|
751
|
+
`Partial`\<`OptionsJson`\>
|
|
752
|
+
|
|
753
|
+
The options to override the default JSON Body Parser options with
|
|
754
|
+
|
|
755
|
+
## Returns
|
|
756
|
+
|
|
757
|
+
`OptionsJson`
|
|
758
|
+
|
|
759
|
+
The combined JSON Body Parser options with the supplied values taking
|
|
760
|
+
precedence over the default
|
|
761
|
+
|
|
762
|
+
### <a id="getLogger"></a>getLogger
|
|
763
|
+
|
|
764
|
+
[**@xylabs/express**](#../README)
|
|
765
|
+
|
|
766
|
+
***
|
|
767
|
+
|
|
768
|
+
```ts
|
|
769
|
+
function getLogger(minVerbosity): Logger;
|
|
770
|
+
```
|
|
771
|
+
|
|
772
|
+
## Parameters
|
|
773
|
+
|
|
774
|
+
### minVerbosity
|
|
775
|
+
|
|
776
|
+
[`LoggerVerbosity`](#../type-aliases/LoggerVerbosity) = `'info'`
|
|
777
|
+
|
|
778
|
+
## Returns
|
|
779
|
+
|
|
780
|
+
`Logger`
|
|
781
|
+
|
|
782
|
+
### <a id="getResponseMetadata"></a>getResponseMetadata
|
|
783
|
+
|
|
784
|
+
[**@xylabs/express**](#../README)
|
|
785
|
+
|
|
786
|
+
***
|
|
787
|
+
|
|
788
|
+
```ts
|
|
789
|
+
function getResponseMetadata(res): Record<string, unknown>;
|
|
790
|
+
```
|
|
791
|
+
|
|
792
|
+
## Parameters
|
|
793
|
+
|
|
794
|
+
### res
|
|
795
|
+
|
|
796
|
+
`Response`
|
|
797
|
+
|
|
798
|
+
## Returns
|
|
799
|
+
|
|
800
|
+
`Record`\<`string`, `unknown`\>
|
|
801
|
+
|
|
802
|
+
### <a id="isRawResponseFormatSet"></a>isRawResponseFormatSet
|
|
803
|
+
|
|
804
|
+
[**@xylabs/express**](#../README)
|
|
805
|
+
|
|
806
|
+
***
|
|
807
|
+
|
|
808
|
+
```ts
|
|
809
|
+
function isRawResponseFormatSet(res): boolean;
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
Checks if there are any flags on the response that would cause it
|
|
813
|
+
to forgo the standard response envelope and return the raw response
|
|
814
|
+
body to the client
|
|
815
|
+
|
|
816
|
+
## Parameters
|
|
817
|
+
|
|
818
|
+
### res
|
|
819
|
+
|
|
820
|
+
`Response`
|
|
821
|
+
|
|
822
|
+
## Returns
|
|
823
|
+
|
|
824
|
+
`boolean`
|
|
825
|
+
|
|
826
|
+
True if there are any flags on the response, false otherwise
|
|
827
|
+
|
|
828
|
+
### <a id="responseProfiler"></a>responseProfiler
|
|
829
|
+
|
|
830
|
+
[**@xylabs/express**](#../README)
|
|
831
|
+
|
|
832
|
+
***
|
|
833
|
+
|
|
834
|
+
```ts
|
|
835
|
+
function responseProfiler(
|
|
836
|
+
_req,
|
|
837
|
+
res,
|
|
838
|
+
next): void;
|
|
839
|
+
```
|
|
840
|
+
|
|
841
|
+
Connect middleware to enable profiling of response lifecycle timing. To effectively profile
|
|
842
|
+
the response timing, this middleware needs to be called first when initializing your Express
|
|
843
|
+
App
|
|
844
|
+
|
|
845
|
+
## Parameters
|
|
846
|
+
|
|
847
|
+
### \_req
|
|
848
|
+
|
|
849
|
+
`Request`
|
|
850
|
+
|
|
851
|
+
The request
|
|
852
|
+
|
|
853
|
+
### res
|
|
854
|
+
|
|
855
|
+
`Response`
|
|
856
|
+
|
|
857
|
+
The response
|
|
858
|
+
|
|
859
|
+
### next
|
|
860
|
+
|
|
861
|
+
`NextFunction`
|
|
862
|
+
|
|
863
|
+
The next function
|
|
864
|
+
|
|
865
|
+
## Returns
|
|
866
|
+
|
|
867
|
+
`void`
|
|
868
|
+
|
|
869
|
+
## Example
|
|
870
|
+
|
|
871
|
+
```ts
|
|
872
|
+
const app = express()
|
|
873
|
+
app.use(responseProfiler)
|
|
874
|
+
// other initialization ...
|
|
875
|
+
```
|
|
876
|
+
|
|
877
|
+
### <a id="setRawResponseFormat"></a>setRawResponseFormat
|
|
878
|
+
|
|
879
|
+
[**@xylabs/express**](#../README)
|
|
880
|
+
|
|
881
|
+
***
|
|
882
|
+
|
|
883
|
+
```ts
|
|
884
|
+
function setRawResponseFormat(res): void;
|
|
885
|
+
```
|
|
886
|
+
|
|
887
|
+
Flags the response to forgo the standard response envelope
|
|
888
|
+
and return the raw response body to the client
|
|
889
|
+
|
|
890
|
+
## Parameters
|
|
891
|
+
|
|
892
|
+
### res
|
|
893
|
+
|
|
894
|
+
`Response`
|
|
895
|
+
|
|
896
|
+
The response to disable the standard response format on
|
|
897
|
+
|
|
898
|
+
## Returns
|
|
899
|
+
|
|
900
|
+
`void`
|
|
901
|
+
|
|
902
|
+
### <a id="standardErrors"></a>standardErrors
|
|
903
|
+
|
|
904
|
+
[**@xylabs/express**](#../README)
|
|
905
|
+
|
|
906
|
+
***
|
|
907
|
+
|
|
908
|
+
```ts
|
|
909
|
+
function standardErrors(
|
|
910
|
+
err,
|
|
911
|
+
req,
|
|
912
|
+
res,
|
|
913
|
+
next): void;
|
|
914
|
+
```
|
|
915
|
+
|
|
916
|
+
## Parameters
|
|
917
|
+
|
|
918
|
+
### err
|
|
919
|
+
|
|
920
|
+
`undefined` | [`ExpressError`](#../interfaces/ExpressError)
|
|
921
|
+
|
|
922
|
+
### req
|
|
923
|
+
|
|
924
|
+
`Request`
|
|
925
|
+
|
|
926
|
+
### res
|
|
927
|
+
|
|
928
|
+
`Response`
|
|
929
|
+
|
|
930
|
+
### next
|
|
931
|
+
|
|
932
|
+
`NextFunction`
|
|
933
|
+
|
|
934
|
+
## Returns
|
|
935
|
+
|
|
936
|
+
`void`
|
|
937
|
+
|
|
938
|
+
### <a id="tryParse"></a>tryParse
|
|
939
|
+
|
|
940
|
+
[**@xylabs/express**](#../README)
|
|
941
|
+
|
|
942
|
+
***
|
|
943
|
+
|
|
944
|
+
```ts
|
|
945
|
+
function tryParse<T>(func, value?): undefined | T & object;
|
|
946
|
+
```
|
|
947
|
+
|
|
948
|
+
## Type Parameters
|
|
949
|
+
|
|
950
|
+
### T
|
|
951
|
+
|
|
952
|
+
`T` = `number`
|
|
953
|
+
|
|
954
|
+
## Parameters
|
|
955
|
+
|
|
956
|
+
### func
|
|
957
|
+
|
|
958
|
+
[`ParseFunc`](#../type-aliases/ParseFunc)\<`T`\>
|
|
959
|
+
|
|
960
|
+
### value?
|
|
961
|
+
|
|
962
|
+
`string`
|
|
963
|
+
|
|
964
|
+
## Returns
|
|
965
|
+
|
|
966
|
+
`undefined` \| `T` & `object`
|
|
967
|
+
|
|
968
|
+
### <a id="tryParseFloat"></a>tryParseFloat
|
|
969
|
+
|
|
970
|
+
[**@xylabs/express**](#../README)
|
|
971
|
+
|
|
972
|
+
***
|
|
973
|
+
|
|
974
|
+
```ts
|
|
975
|
+
function tryParseFloat(value?): undefined | number;
|
|
976
|
+
```
|
|
977
|
+
|
|
978
|
+
## Parameters
|
|
979
|
+
|
|
980
|
+
### value?
|
|
981
|
+
|
|
982
|
+
`string`
|
|
983
|
+
|
|
984
|
+
## Returns
|
|
985
|
+
|
|
986
|
+
`undefined` \| `number`
|
|
987
|
+
|
|
988
|
+
### <a id="tryParseInt"></a>tryParseInt
|
|
989
|
+
|
|
990
|
+
[**@xylabs/express**](#../README)
|
|
991
|
+
|
|
992
|
+
***
|
|
993
|
+
|
|
994
|
+
```ts
|
|
995
|
+
function tryParseInt(value?): undefined | number;
|
|
996
|
+
```
|
|
997
|
+
|
|
998
|
+
## Parameters
|
|
999
|
+
|
|
1000
|
+
### value?
|
|
1001
|
+
|
|
1002
|
+
`string`
|
|
1003
|
+
|
|
1004
|
+
## Returns
|
|
1005
|
+
|
|
1006
|
+
`undefined` \| `number`
|
|
1007
|
+
|
|
1008
|
+
### <a id="useRequestCounters"></a>useRequestCounters
|
|
1009
|
+
|
|
1010
|
+
[**@xylabs/express**](#../README)
|
|
1011
|
+
|
|
1012
|
+
***
|
|
1013
|
+
|
|
1014
|
+
```ts
|
|
1015
|
+
function useRequestCounters(app): void;
|
|
1016
|
+
```
|
|
1017
|
+
|
|
1018
|
+
## Parameters
|
|
1019
|
+
|
|
1020
|
+
### app
|
|
1021
|
+
|
|
1022
|
+
`Application`
|
|
1023
|
+
|
|
1024
|
+
## Returns
|
|
1025
|
+
|
|
1026
|
+
`void`
|
|
1027
|
+
|
|
1028
|
+
### interfaces
|
|
1029
|
+
|
|
1030
|
+
### <a id="ApiDataResponse"></a>ApiDataResponse
|
|
1031
|
+
|
|
1032
|
+
[**@xylabs/express**](#../README)
|
|
1033
|
+
|
|
1034
|
+
***
|
|
1035
|
+
|
|
1036
|
+
## Extends
|
|
1037
|
+
|
|
1038
|
+
- [`ApiResponseBase`](#ApiResponseBase)
|
|
1039
|
+
|
|
1040
|
+
## Type Parameters
|
|
1041
|
+
|
|
1042
|
+
### T
|
|
1043
|
+
|
|
1044
|
+
`T` *extends* [`ApiResourceIdentifierObject`](#ApiResourceIdentifierObject)
|
|
1045
|
+
|
|
1046
|
+
## Properties
|
|
1047
|
+
|
|
1048
|
+
### jsonapi?
|
|
1049
|
+
|
|
1050
|
+
```ts
|
|
1051
|
+
optional jsonapi: JsonApi;
|
|
1052
|
+
```
|
|
1053
|
+
|
|
1054
|
+
### Inherited from
|
|
1055
|
+
|
|
1056
|
+
[`ApiResponseBase`](#ApiResponseBase).[`jsonapi`](ApiResponseBase.md#jsonapi)
|
|
1057
|
+
|
|
1058
|
+
***
|
|
1059
|
+
|
|
1060
|
+
### links?
|
|
1061
|
+
|
|
1062
|
+
```ts
|
|
1063
|
+
optional links: ApiLinks;
|
|
1064
|
+
```
|
|
1065
|
+
|
|
1066
|
+
### Inherited from
|
|
1067
|
+
|
|
1068
|
+
[`ApiResponseBase`](#ApiResponseBase).[`links`](ApiResponseBase.md#links)
|
|
1069
|
+
|
|
1070
|
+
***
|
|
1071
|
+
|
|
1072
|
+
### meta?
|
|
1073
|
+
|
|
1074
|
+
```ts
|
|
1075
|
+
optional meta: Record<string, unknown>;
|
|
1076
|
+
```
|
|
1077
|
+
|
|
1078
|
+
### Inherited from
|
|
1079
|
+
|
|
1080
|
+
[`ApiResponseBase`](#ApiResponseBase).[`meta`](ApiResponseBase.md#meta)
|
|
1081
|
+
|
|
1082
|
+
***
|
|
1083
|
+
|
|
1084
|
+
### data
|
|
1085
|
+
|
|
1086
|
+
```ts
|
|
1087
|
+
data: T;
|
|
1088
|
+
```
|
|
1089
|
+
|
|
1090
|
+
***
|
|
1091
|
+
|
|
1092
|
+
### included?
|
|
1093
|
+
|
|
1094
|
+
```ts
|
|
1095
|
+
optional included: ApiResourceObject[];
|
|
1096
|
+
```
|
|
1097
|
+
|
|
1098
|
+
### <a id="ApiError"></a>ApiError
|
|
1099
|
+
|
|
1100
|
+
[**@xylabs/express**](#../README)
|
|
1101
|
+
|
|
1102
|
+
***
|
|
1103
|
+
|
|
1104
|
+
## Properties
|
|
1105
|
+
|
|
1106
|
+
### code?
|
|
1107
|
+
|
|
1108
|
+
```ts
|
|
1109
|
+
optional code: string;
|
|
1110
|
+
```
|
|
1111
|
+
|
|
1112
|
+
An application-specific error code, expressed as a string value.
|
|
1113
|
+
|
|
1114
|
+
***
|
|
1115
|
+
|
|
1116
|
+
### detail?
|
|
1117
|
+
|
|
1118
|
+
```ts
|
|
1119
|
+
optional detail: string;
|
|
1120
|
+
```
|
|
1121
|
+
|
|
1122
|
+
A human-readable explanation specific to this occurrence of the problem. Like title, this field's value can be localized.
|
|
1123
|
+
|
|
1124
|
+
***
|
|
1125
|
+
|
|
1126
|
+
### id?
|
|
1127
|
+
|
|
1128
|
+
```ts
|
|
1129
|
+
optional id: string;
|
|
1130
|
+
```
|
|
1131
|
+
|
|
1132
|
+
A unique identifier for this particular occurrence of the problem.
|
|
1133
|
+
|
|
1134
|
+
***
|
|
1135
|
+
|
|
1136
|
+
### links?
|
|
1137
|
+
|
|
1138
|
+
```ts
|
|
1139
|
+
optional links: ApiLinks;
|
|
1140
|
+
```
|
|
1141
|
+
|
|
1142
|
+
A links object containing the following members:
|
|
1143
|
+
about: a link that leads to further details about this particular occurrence of the problem
|
|
1144
|
+
|
|
1145
|
+
***
|
|
1146
|
+
|
|
1147
|
+
### meta?
|
|
1148
|
+
|
|
1149
|
+
```ts
|
|
1150
|
+
optional meta: Record<string, unknown>;
|
|
1151
|
+
```
|
|
1152
|
+
|
|
1153
|
+
A meta object containing non-standard meta-information about the error.
|
|
1154
|
+
|
|
1155
|
+
***
|
|
1156
|
+
|
|
1157
|
+
### source?
|
|
1158
|
+
|
|
1159
|
+
```ts
|
|
1160
|
+
optional source: Source;
|
|
1161
|
+
```
|
|
1162
|
+
|
|
1163
|
+
An object containing references to the source of the error, optionally including any of the following members:
|
|
1164
|
+
|
|
1165
|
+
***
|
|
1166
|
+
|
|
1167
|
+
### status?
|
|
1168
|
+
|
|
1169
|
+
```ts
|
|
1170
|
+
optional status: string;
|
|
1171
|
+
```
|
|
1172
|
+
|
|
1173
|
+
The HTTP status code applicable to this problem, expressed as a string value.
|
|
1174
|
+
|
|
1175
|
+
***
|
|
1176
|
+
|
|
1177
|
+
### title?
|
|
1178
|
+
|
|
1179
|
+
```ts
|
|
1180
|
+
optional title: string;
|
|
1181
|
+
```
|
|
1182
|
+
|
|
1183
|
+
A short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization.
|
|
1184
|
+
|
|
1185
|
+
### <a id="ApiErrorResponse"></a>ApiErrorResponse
|
|
1186
|
+
|
|
1187
|
+
[**@xylabs/express**](#../README)
|
|
1188
|
+
|
|
1189
|
+
***
|
|
1190
|
+
|
|
1191
|
+
## Extends
|
|
1192
|
+
|
|
1193
|
+
- [`ApiResponseBase`](#ApiResponseBase)
|
|
1194
|
+
|
|
1195
|
+
## Properties
|
|
1196
|
+
|
|
1197
|
+
### jsonapi?
|
|
1198
|
+
|
|
1199
|
+
```ts
|
|
1200
|
+
optional jsonapi: JsonApi;
|
|
1201
|
+
```
|
|
1202
|
+
|
|
1203
|
+
### Inherited from
|
|
1204
|
+
|
|
1205
|
+
[`ApiResponseBase`](#ApiResponseBase).[`jsonapi`](ApiResponseBase.md#jsonapi)
|
|
1206
|
+
|
|
1207
|
+
***
|
|
1208
|
+
|
|
1209
|
+
### links?
|
|
1210
|
+
|
|
1211
|
+
```ts
|
|
1212
|
+
optional links: ApiLinks;
|
|
1213
|
+
```
|
|
1214
|
+
|
|
1215
|
+
### Inherited from
|
|
1216
|
+
|
|
1217
|
+
[`ApiResponseBase`](#ApiResponseBase).[`links`](ApiResponseBase.md#links)
|
|
1218
|
+
|
|
1219
|
+
***
|
|
1220
|
+
|
|
1221
|
+
### meta?
|
|
1222
|
+
|
|
1223
|
+
```ts
|
|
1224
|
+
optional meta: Record<string, unknown>;
|
|
1225
|
+
```
|
|
1226
|
+
|
|
1227
|
+
### Inherited from
|
|
1228
|
+
|
|
1229
|
+
[`ApiResponseBase`](#ApiResponseBase).[`meta`](ApiResponseBase.md#meta)
|
|
1230
|
+
|
|
1231
|
+
***
|
|
1232
|
+
|
|
1233
|
+
### errors
|
|
1234
|
+
|
|
1235
|
+
```ts
|
|
1236
|
+
errors: ApiError[];
|
|
1237
|
+
```
|
|
1238
|
+
|
|
1239
|
+
### <a id="ApiResourceIdentifierObject"></a>ApiResourceIdentifierObject
|
|
1240
|
+
|
|
1241
|
+
[**@xylabs/express**](#../README)
|
|
1242
|
+
|
|
1243
|
+
***
|
|
1244
|
+
|
|
1245
|
+
Within a given API, each resource object's type and id pair MUST identify a single, unique resource.
|
|
1246
|
+
(The set of URIs controlled by a server, or multiple servers acting as one, constitute an API.)
|
|
1247
|
+
|
|
1248
|
+
## Extended by
|
|
1249
|
+
|
|
1250
|
+
- [`ApiResourceObject`](#ApiResourceObject)
|
|
1251
|
+
|
|
1252
|
+
## Properties
|
|
1253
|
+
|
|
1254
|
+
### id
|
|
1255
|
+
|
|
1256
|
+
```ts
|
|
1257
|
+
id: string;
|
|
1258
|
+
```
|
|
1259
|
+
|
|
1260
|
+
The id member is not required when the resource object originates at the client and represents a new resource to be created on the server.
|
|
1261
|
+
|
|
1262
|
+
***
|
|
1263
|
+
|
|
1264
|
+
### type
|
|
1265
|
+
|
|
1266
|
+
```ts
|
|
1267
|
+
type: string;
|
|
1268
|
+
```
|
|
1269
|
+
|
|
1270
|
+
The type member is used to describe resource objects that share common attributes and relationships.
|
|
1271
|
+
The values of type members MUST adhere to the same constraints as member names.
|
|
1272
|
+
|
|
1273
|
+
### <a id="ApiResourceObject"></a>ApiResourceObject
|
|
1274
|
+
|
|
1275
|
+
[**@xylabs/express**](#../README)
|
|
1276
|
+
|
|
1277
|
+
***
|
|
1278
|
+
|
|
1279
|
+
Within a given API, each resource object's type and id pair MUST identify a single, unique resource.
|
|
1280
|
+
(The set of URIs controlled by a server, or multiple servers acting as one, constitute an API.)
|
|
1281
|
+
|
|
1282
|
+
## Extends
|
|
1283
|
+
|
|
1284
|
+
- [`ApiResourceIdentifierObject`](#ApiResourceIdentifierObject)
|
|
1285
|
+
|
|
1286
|
+
## Properties
|
|
1287
|
+
|
|
1288
|
+
### id
|
|
1289
|
+
|
|
1290
|
+
```ts
|
|
1291
|
+
id: string;
|
|
1292
|
+
```
|
|
1293
|
+
|
|
1294
|
+
The id member is not required when the resource object originates at the client and represents a new resource to be created on the server.
|
|
1295
|
+
|
|
1296
|
+
### Inherited from
|
|
1297
|
+
|
|
1298
|
+
[`ApiResourceIdentifierObject`](#ApiResourceIdentifierObject).[`id`](ApiResourceIdentifierObject.md#id)
|
|
1299
|
+
|
|
1300
|
+
***
|
|
1301
|
+
|
|
1302
|
+
### type
|
|
1303
|
+
|
|
1304
|
+
```ts
|
|
1305
|
+
type: string;
|
|
1306
|
+
```
|
|
1307
|
+
|
|
1308
|
+
The type member is used to describe resource objects that share common attributes and relationships.
|
|
1309
|
+
The values of type members MUST adhere to the same constraints as member names.
|
|
1310
|
+
|
|
1311
|
+
### Inherited from
|
|
1312
|
+
|
|
1313
|
+
[`ApiResourceIdentifierObject`](#ApiResourceIdentifierObject).[`type`](ApiResourceIdentifierObject.md#type)
|
|
1314
|
+
|
|
1315
|
+
***
|
|
1316
|
+
|
|
1317
|
+
### attributes?
|
|
1318
|
+
|
|
1319
|
+
```ts
|
|
1320
|
+
optional attributes: Record<string, unknown>;
|
|
1321
|
+
```
|
|
1322
|
+
|
|
1323
|
+
An attributes object representing some of the resource's data.
|
|
1324
|
+
|
|
1325
|
+
***
|
|
1326
|
+
|
|
1327
|
+
### links?
|
|
1328
|
+
|
|
1329
|
+
```ts
|
|
1330
|
+
optional links: ApiLinks;
|
|
1331
|
+
```
|
|
1332
|
+
|
|
1333
|
+
A links object containing links related to the resource.
|
|
1334
|
+
|
|
1335
|
+
***
|
|
1336
|
+
|
|
1337
|
+
### meta?
|
|
1338
|
+
|
|
1339
|
+
```ts
|
|
1340
|
+
optional meta: Record<string, unknown>;
|
|
1341
|
+
```
|
|
1342
|
+
|
|
1343
|
+
A meta object containing non-standard meta-information about a resource that can not be represented as an attribute or relationship.
|
|
1344
|
+
|
|
1345
|
+
***
|
|
1346
|
+
|
|
1347
|
+
### relationships?
|
|
1348
|
+
|
|
1349
|
+
```ts
|
|
1350
|
+
optional relationships: Record<string, Relationship>;
|
|
1351
|
+
```
|
|
1352
|
+
|
|
1353
|
+
A relationships object describing relationships between the resource and other JSON:API resources.
|
|
1354
|
+
|
|
1355
|
+
### <a id="ApiResponseBase"></a>ApiResponseBase
|
|
1356
|
+
|
|
1357
|
+
[**@xylabs/express**](#../README)
|
|
1358
|
+
|
|
1359
|
+
***
|
|
1360
|
+
|
|
1361
|
+
## Extended by
|
|
1362
|
+
|
|
1363
|
+
- [`ApiDataResponse`](#ApiDataResponse)
|
|
1364
|
+
- [`ApiErrorResponse`](#ApiErrorResponse)
|
|
1365
|
+
|
|
1366
|
+
## Properties
|
|
1367
|
+
|
|
1368
|
+
### jsonapi?
|
|
1369
|
+
|
|
1370
|
+
```ts
|
|
1371
|
+
optional jsonapi: JsonApi;
|
|
1372
|
+
```
|
|
1373
|
+
|
|
1374
|
+
***
|
|
1375
|
+
|
|
1376
|
+
### links?
|
|
1377
|
+
|
|
1378
|
+
```ts
|
|
1379
|
+
optional links: ApiLinks;
|
|
1380
|
+
```
|
|
1381
|
+
|
|
1382
|
+
***
|
|
1383
|
+
|
|
1384
|
+
### meta?
|
|
1385
|
+
|
|
1386
|
+
```ts
|
|
1387
|
+
optional meta: Record<string, unknown>;
|
|
1388
|
+
```
|
|
1389
|
+
|
|
1390
|
+
### <a id="Empty"></a>Empty
|
|
1391
|
+
|
|
1392
|
+
[**@xylabs/express**](#../README)
|
|
1393
|
+
|
|
1394
|
+
***
|
|
1395
|
+
|
|
1396
|
+
### <a id="ExpressError"></a>ExpressError
|
|
1397
|
+
|
|
1398
|
+
[**@xylabs/express**](#../README)
|
|
1399
|
+
|
|
1400
|
+
***
|
|
1401
|
+
|
|
1402
|
+
## Extends
|
|
1403
|
+
|
|
1404
|
+
- `Error`
|
|
1405
|
+
|
|
1406
|
+
## Properties
|
|
1407
|
+
|
|
1408
|
+
### statusCode?
|
|
1409
|
+
|
|
1410
|
+
```ts
|
|
1411
|
+
optional statusCode: number;
|
|
1412
|
+
```
|
|
1413
|
+
|
|
1414
|
+
### <a id="HrefWithMeta"></a>HrefWithMeta
|
|
1415
|
+
|
|
1416
|
+
[**@xylabs/express**](#../README)
|
|
1417
|
+
|
|
1418
|
+
***
|
|
1419
|
+
|
|
1420
|
+
## Properties
|
|
1421
|
+
|
|
1422
|
+
### href
|
|
1423
|
+
|
|
1424
|
+
```ts
|
|
1425
|
+
href: string;
|
|
1426
|
+
```
|
|
1427
|
+
|
|
1428
|
+
***
|
|
1429
|
+
|
|
1430
|
+
### meta
|
|
1431
|
+
|
|
1432
|
+
```ts
|
|
1433
|
+
meta: Record<string, unknown>;
|
|
1434
|
+
```
|
|
1435
|
+
|
|
1436
|
+
### <a id="IRelationshipData"></a>IRelationshipData
|
|
1437
|
+
|
|
1438
|
+
[**@xylabs/express**](#../README)
|
|
1439
|
+
|
|
1440
|
+
***
|
|
1441
|
+
|
|
1442
|
+
## Properties
|
|
1443
|
+
|
|
1444
|
+
### data
|
|
1445
|
+
|
|
1446
|
+
```ts
|
|
1447
|
+
data: ResourceLinkage;
|
|
1448
|
+
```
|
|
1449
|
+
|
|
1450
|
+
### <a id="IRelationshipLinks"></a>IRelationshipLinks
|
|
1451
|
+
|
|
1452
|
+
[**@xylabs/express**](#../README)
|
|
1453
|
+
|
|
1454
|
+
***
|
|
1455
|
+
|
|
1456
|
+
## Properties
|
|
1457
|
+
|
|
1458
|
+
### links
|
|
1459
|
+
|
|
1460
|
+
```ts
|
|
1461
|
+
links:
|
|
1462
|
+
| IRelationshipSelfLink
|
|
1463
|
+
| IRelationshipRelatedLink;
|
|
1464
|
+
```
|
|
1465
|
+
|
|
1466
|
+
### <a id="IRelationshipRelatedLink"></a>IRelationshipRelatedLink
|
|
1467
|
+
|
|
1468
|
+
[**@xylabs/express**](#../README)
|
|
1469
|
+
|
|
1470
|
+
***
|
|
1471
|
+
|
|
1472
|
+
## Properties
|
|
1473
|
+
|
|
1474
|
+
### related
|
|
1475
|
+
|
|
1476
|
+
```ts
|
|
1477
|
+
related: string;
|
|
1478
|
+
```
|
|
1479
|
+
|
|
1480
|
+
A related resource link
|
|
1481
|
+
|
|
1482
|
+
### <a id="IRelationshipSelfLink"></a>IRelationshipSelfLink
|
|
1483
|
+
|
|
1484
|
+
[**@xylabs/express**](#../README)
|
|
1485
|
+
|
|
1486
|
+
***
|
|
1487
|
+
|
|
1488
|
+
## Properties
|
|
1489
|
+
|
|
1490
|
+
### self
|
|
1491
|
+
|
|
1492
|
+
```ts
|
|
1493
|
+
self: string;
|
|
1494
|
+
```
|
|
1495
|
+
|
|
1496
|
+
A link for the relationship itself (a "relationship link"). This link allows the client to directly manipulate the relationship.
|
|
1497
|
+
For example, removing an author through an article’s relationship URL would disconnect the person from the article without
|
|
1498
|
+
deleting the people resource itself. When fetched successfully, this link returns the linkage for the related resources as its primary data.
|
|
1499
|
+
|
|
1500
|
+
### <a id="JsonApi"></a>JsonApi
|
|
1501
|
+
|
|
1502
|
+
[**@xylabs/express**](#../README)
|
|
1503
|
+
|
|
1504
|
+
***
|
|
1505
|
+
|
|
1506
|
+
## Properties
|
|
1507
|
+
|
|
1508
|
+
### meta?
|
|
1509
|
+
|
|
1510
|
+
```ts
|
|
1511
|
+
optional meta: Record<string, unknown>;
|
|
1512
|
+
```
|
|
1513
|
+
|
|
1514
|
+
***
|
|
1515
|
+
|
|
1516
|
+
### version?
|
|
1517
|
+
|
|
1518
|
+
```ts
|
|
1519
|
+
optional version: "1.0" | "1.1";
|
|
1520
|
+
```
|
|
1521
|
+
|
|
1522
|
+
### <a id="LoggerOptions"></a>LoggerOptions
|
|
1523
|
+
|
|
1524
|
+
[**@xylabs/express**](#../README)
|
|
1525
|
+
|
|
1526
|
+
***
|
|
1527
|
+
|
|
1528
|
+
## Properties
|
|
1529
|
+
|
|
1530
|
+
### defaultMeta?
|
|
1531
|
+
|
|
1532
|
+
```ts
|
|
1533
|
+
optional defaultMeta: LoggerMeta;
|
|
1534
|
+
```
|
|
1535
|
+
|
|
1536
|
+
***
|
|
1537
|
+
|
|
1538
|
+
### level?
|
|
1539
|
+
|
|
1540
|
+
```ts
|
|
1541
|
+
optional level: LoggerVerbosity;
|
|
1542
|
+
```
|
|
1543
|
+
|
|
1544
|
+
### <a id="Source"></a>Source
|
|
1545
|
+
|
|
1546
|
+
[**@xylabs/express**](#../README)
|
|
1547
|
+
|
|
1548
|
+
***
|
|
1549
|
+
|
|
1550
|
+
An object containing references to the source of the error
|
|
1551
|
+
|
|
1552
|
+
## Properties
|
|
1553
|
+
|
|
1554
|
+
### parameter?
|
|
1555
|
+
|
|
1556
|
+
```ts
|
|
1557
|
+
optional parameter: string;
|
|
1558
|
+
```
|
|
1559
|
+
|
|
1560
|
+
A string indicating which URI query parameter caused the error.
|
|
1561
|
+
|
|
1562
|
+
***
|
|
1563
|
+
|
|
1564
|
+
### pointer?
|
|
1565
|
+
|
|
1566
|
+
```ts
|
|
1567
|
+
optional pointer: string;
|
|
1568
|
+
```
|
|
1569
|
+
|
|
1570
|
+
A JSON Pointer [RFC6901] to the associated entity in the request document [e.g. "/data" for a primary data object,
|
|
1571
|
+
or "/data/attributes/title" for a specific attribute].
|
|
1572
|
+
|
|
1573
|
+
### type-aliases
|
|
1574
|
+
|
|
1575
|
+
### <a id="ApiLink"></a>ApiLink
|
|
1576
|
+
|
|
1577
|
+
[**@xylabs/express**](#../README)
|
|
1578
|
+
|
|
1579
|
+
***
|
|
1580
|
+
|
|
1581
|
+
```ts
|
|
1582
|
+
type ApiLink = string | HrefWithMeta;
|
|
1583
|
+
```
|
|
1584
|
+
|
|
1585
|
+
### <a id="ApiLinks"></a>ApiLinks
|
|
1586
|
+
|
|
1587
|
+
[**@xylabs/express**](#../README)
|
|
1588
|
+
|
|
1589
|
+
***
|
|
1590
|
+
|
|
1591
|
+
```ts
|
|
1592
|
+
type ApiLinks = Record<string, ApiLink>;
|
|
1593
|
+
```
|
|
1594
|
+
|
|
1595
|
+
### <a id="ApiResponse"></a>ApiResponse
|
|
1596
|
+
|
|
1597
|
+
[**@xylabs/express**](#../README)
|
|
1598
|
+
|
|
1599
|
+
***
|
|
1600
|
+
|
|
1601
|
+
```ts
|
|
1602
|
+
type ApiResponse<T> =
|
|
1603
|
+
| ApiDataResponse<T>
|
|
1604
|
+
| ApiErrorResponse;
|
|
1605
|
+
```
|
|
1606
|
+
|
|
1607
|
+
## Type Parameters
|
|
1608
|
+
|
|
1609
|
+
### T
|
|
1610
|
+
|
|
1611
|
+
`T` *extends* [`ApiResourceIdentifierObject`](#../interfaces/ApiResourceIdentifierObject)
|
|
1612
|
+
|
|
1613
|
+
### <a id="LogFunction"></a>LogFunction
|
|
1614
|
+
|
|
1615
|
+
[**@xylabs/express**](#../README)
|
|
1616
|
+
|
|
1617
|
+
***
|
|
1618
|
+
|
|
1619
|
+
```ts
|
|
1620
|
+
type LogFunction = XyLabsLogFunction;
|
|
1621
|
+
```
|
|
1622
|
+
|
|
1623
|
+
## Deprecated
|
|
1624
|
+
|
|
1625
|
+
use from @xylabs/logger instead
|
|
1626
|
+
|
|
1627
|
+
### <a id="Logger"></a>Logger
|
|
1628
|
+
|
|
1629
|
+
[**@xylabs/express**](#../README)
|
|
1630
|
+
|
|
1631
|
+
***
|
|
1632
|
+
|
|
1633
|
+
```ts
|
|
1634
|
+
type Logger = XyLabsLogger;
|
|
1635
|
+
```
|
|
1636
|
+
|
|
1637
|
+
## Deprecated
|
|
1638
|
+
|
|
1639
|
+
use from @xylabs/logger instead
|
|
1640
|
+
|
|
1641
|
+
### <a id="LoggerMeta"></a>LoggerMeta
|
|
1642
|
+
|
|
1643
|
+
[**@xylabs/express**](#../README)
|
|
1644
|
+
|
|
1645
|
+
***
|
|
1646
|
+
|
|
1647
|
+
```ts
|
|
1648
|
+
type LoggerMeta = Record<string, string | number>;
|
|
1649
|
+
```
|
|
1650
|
+
|
|
1651
|
+
### <a id="LoggerVerbosity"></a>LoggerVerbosity
|
|
1652
|
+
|
|
1653
|
+
[**@xylabs/express**](#../README)
|
|
1654
|
+
|
|
1655
|
+
***
|
|
1656
|
+
|
|
1657
|
+
```ts
|
|
1658
|
+
type LoggerVerbosity = "error" | "warn" | "info" | "debug" | "all";
|
|
1659
|
+
```
|
|
1660
|
+
|
|
1661
|
+
### <a id="NoLocals"></a>NoLocals
|
|
1662
|
+
|
|
1663
|
+
[**@xylabs/express**](#../README)
|
|
1664
|
+
|
|
1665
|
+
***
|
|
1666
|
+
|
|
1667
|
+
```ts
|
|
1668
|
+
type NoLocals = Record<string, any>;
|
|
1669
|
+
```
|
|
1670
|
+
|
|
1671
|
+
### <a id="NoReqBody"></a>NoReqBody
|
|
1672
|
+
|
|
1673
|
+
[**@xylabs/express**](#../README)
|
|
1674
|
+
|
|
1675
|
+
***
|
|
1676
|
+
|
|
1677
|
+
```ts
|
|
1678
|
+
type NoReqBody = Empty;
|
|
1679
|
+
```
|
|
1680
|
+
|
|
1681
|
+
### <a id="NoReqParams"></a>NoReqParams
|
|
1682
|
+
|
|
1683
|
+
[**@xylabs/express**](#../README)
|
|
1684
|
+
|
|
1685
|
+
***
|
|
1686
|
+
|
|
1687
|
+
```ts
|
|
1688
|
+
type NoReqParams = ParamsDictionary;
|
|
1689
|
+
```
|
|
1690
|
+
|
|
1691
|
+
### <a id="NoReqQuery"></a>NoReqQuery
|
|
1692
|
+
|
|
1693
|
+
[**@xylabs/express**](#../README)
|
|
1694
|
+
|
|
1695
|
+
***
|
|
1696
|
+
|
|
1697
|
+
```ts
|
|
1698
|
+
type NoReqQuery = Query;
|
|
1699
|
+
```
|
|
1700
|
+
|
|
1701
|
+
### <a id="NoResBody"></a>NoResBody
|
|
1702
|
+
|
|
1703
|
+
[**@xylabs/express**](#../README)
|
|
1704
|
+
|
|
1705
|
+
***
|
|
1706
|
+
|
|
1707
|
+
```ts
|
|
1708
|
+
type NoResBody = Empty;
|
|
1709
|
+
```
|
|
1710
|
+
|
|
1711
|
+
### <a id="ParseFunc"></a>ParseFunc
|
|
1712
|
+
|
|
1713
|
+
[**@xylabs/express**](#../README)
|
|
1714
|
+
|
|
1715
|
+
***
|
|
1716
|
+
|
|
1717
|
+
```ts
|
|
1718
|
+
type ParseFunc<T> = (value) => T;
|
|
1719
|
+
```
|
|
1720
|
+
|
|
1721
|
+
## Type Parameters
|
|
1722
|
+
|
|
1723
|
+
### T
|
|
1724
|
+
|
|
1725
|
+
`T` = `number`
|
|
1726
|
+
|
|
1727
|
+
## Parameters
|
|
1728
|
+
|
|
1729
|
+
### value
|
|
1730
|
+
|
|
1731
|
+
`string`
|
|
1732
|
+
|
|
1733
|
+
## Returns
|
|
1734
|
+
|
|
1735
|
+
`T`
|
|
1736
|
+
|
|
1737
|
+
### <a id="Relationship"></a>Relationship
|
|
1738
|
+
|
|
1739
|
+
[**@xylabs/express**](#../README)
|
|
1740
|
+
|
|
1741
|
+
***
|
|
1742
|
+
|
|
1743
|
+
```ts
|
|
1744
|
+
type Relationship =
|
|
1745
|
+
| IRelationshipLinks
|
|
1746
|
+
| IRelationshipData
|
|
1747
|
+
| RelationshipMeta;
|
|
1748
|
+
```
|
|
1749
|
+
|
|
1750
|
+
The value of the relationships key MUST be an object (a "relationships object"). Members of the relationships object ("relationships")
|
|
1751
|
+
represent references from the resource object in which it’s defined to other resource objects.
|
|
1752
|
+
Relationships may be to-one or to-many.
|
|
1753
|
+
|
|
1754
|
+
### <a id="RelationshipMeta"></a>RelationshipMeta
|
|
1755
|
+
|
|
1756
|
+
[**@xylabs/express**](#../README)
|
|
1757
|
+
|
|
1758
|
+
***
|
|
1759
|
+
|
|
1760
|
+
```ts
|
|
1761
|
+
type RelationshipMeta = Record<string, unknown>;
|
|
1762
|
+
```
|
|
1763
|
+
|
|
1764
|
+
### <a id="ResourceLinkage"></a>ResourceLinkage
|
|
1765
|
+
|
|
1766
|
+
[**@xylabs/express**](#../README)
|
|
1767
|
+
|
|
1768
|
+
***
|
|
1769
|
+
|
|
1770
|
+
```ts
|
|
1771
|
+
type ResourceLinkage =
|
|
1772
|
+
| null
|
|
1773
|
+
| []
|
|
1774
|
+
| ApiResourceIdentifierObject
|
|
1775
|
+
| ApiResourceIdentifierObject[];
|
|
1776
|
+
```
|
|
1777
|
+
|
|
1778
|
+
Resource linkage in a compound document allows a client to link together all of the included resource objects without having to GET any URLs via links.
|
|
1779
|
+
Resource linkage MUST be represented as one of the following:
|
|
1780
|
+
• null for empty to-one relationships.
|
|
1781
|
+
• an empty array ([]) for empty to-many relationships.
|
|
1782
|
+
• a single resource identifier object for non-empty to-one relationships.
|
|
1783
|
+
• an array of resource identifier objects for non-empty to-many relationships.
|
|
1784
|
+
|
|
1785
|
+
### variables
|
|
1786
|
+
|
|
1787
|
+
### <a id="DefaultJsonBodyParserOptions"></a>DefaultJsonBodyParserOptions
|
|
1788
|
+
|
|
1789
|
+
[**@xylabs/express**](#../README)
|
|
1790
|
+
|
|
1791
|
+
***
|
|
1792
|
+
|
|
1793
|
+
```ts
|
|
1794
|
+
const DefaultJsonBodyParserOptions: OptionsJson;
|
|
1795
|
+
```
|
|
1796
|
+
|
|
1797
|
+
The default options for the JSON Body Parser
|
|
1798
|
+
|
|
1799
|
+
### <a id="DefaultJsonBodyParserOptionsLimit"></a>DefaultJsonBodyParserOptionsLimit
|
|
1800
|
+
|
|
1801
|
+
[**@xylabs/express**](#../README)
|
|
1802
|
+
|
|
1803
|
+
***
|
|
1804
|
+
|
|
1805
|
+
```ts
|
|
1806
|
+
const DefaultJsonBodyParserOptionsLimit: "100kb" = '100kb';
|
|
1807
|
+
```
|
|
1808
|
+
|
|
1809
|
+
The default maximum request body size for the JSON Body Parser
|
|
1810
|
+
|
|
1811
|
+
### <a id="DefaultJsonBodyParserOptionsTypes"></a>DefaultJsonBodyParserOptionsTypes
|
|
1812
|
+
|
|
1813
|
+
[**@xylabs/express**](#../README)
|
|
1814
|
+
|
|
1815
|
+
***
|
|
1816
|
+
|
|
1817
|
+
```ts
|
|
1818
|
+
const DefaultJsonBodyParserOptionsTypes: string[];
|
|
1819
|
+
```
|
|
1820
|
+
|
|
1821
|
+
The default MIME types for the JSON Body Parser
|
|
1822
|
+
|
|
1823
|
+
### <a id="jsonBodyParser"></a>jsonBodyParser
|
|
1824
|
+
|
|
1825
|
+
[**@xylabs/express**](#../README)
|
|
1826
|
+
|
|
1827
|
+
***
|
|
1828
|
+
|
|
1829
|
+
```ts
|
|
1830
|
+
const jsonBodyParser: NextHandleFunction;
|
|
1831
|
+
```
|
|
1832
|
+
|
|
1833
|
+
A JSON Body Parser middleware handler initialized with the default options
|
|
1834
|
+
|
|
1835
|
+
### <a id="notImplemented"></a>notImplemented
|
|
1836
|
+
|
|
1837
|
+
[**@xylabs/express**](#../README)
|
|
1838
|
+
|
|
1839
|
+
***
|
|
1840
|
+
|
|
1841
|
+
```ts
|
|
1842
|
+
const notImplemented: RequestHandler;
|
|
1843
|
+
```
|
|
1844
|
+
|
|
1845
|
+
### <a id="standardResponses"></a>standardResponses
|
|
1846
|
+
|
|
1847
|
+
[**@xylabs/express**](#../README)
|
|
1848
|
+
|
|
1849
|
+
***
|
|
1850
|
+
|
|
1851
|
+
```ts
|
|
1852
|
+
const standardResponses: RequestHandler;
|
|
1853
|
+
```
|
|
1854
|
+
|
|
1855
|
+
Connect middleware to enable the transform of all responses to match
|
|
1856
|
+
the standard response format (compatible with JSON API)
|
|
20
1857
|
|
|
21
|
-
Coming Soon!
|
|
22
1858
|
|
|
23
1859
|
Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
|
|
24
1860
|
|