@innet/server 2.0.0-alpha.2 → 2.0.0-alpha.20

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.
Files changed (208) hide show
  1. package/README.md +1105 -403
  2. package/example/requests/index.d.ts +1 -1
  3. package/example/requests/todo/AddTodo/AddTodo.d.ts +1 -0
  4. package/example/requests/todo/AddTodo/index.d.ts +1 -0
  5. package/example/requests/todo/DeleteTodo/DeleteTodo.d.ts +1 -0
  6. package/example/requests/todo/DeleteTodo/index.d.ts +1 -0
  7. package/example/requests/todo/EditTodo/EditTodo.d.ts +1 -0
  8. package/example/requests/todo/EditTodo/index.d.ts +1 -0
  9. package/example/requests/todo/GetTodo/GetTodo.d.ts +1 -0
  10. package/example/requests/todo/GetTodo/index.d.ts +1 -0
  11. package/example/requests/todo/GetTodos/GetTodos.d.ts +1 -0
  12. package/example/requests/todo/GetTodos/index.d.ts +1 -0
  13. package/example/requests/todo/index.d.ts +5 -0
  14. package/example/requests/todo/todos.d.ts +1 -0
  15. package/example/schemas/app/ListQueryParams/ListQueryParams.d.ts +1 -0
  16. package/example/schemas/app/ListQueryParams/index.d.ts +1 -0
  17. package/example/schemas/app/ListSchema/ListSchema.d.ts +4 -1
  18. package/example/schemas/app/index.d.ts +1 -0
  19. package/example/schemas/index.d.ts +1 -3
  20. package/example/schemas/todo/TodoSchema/TodoSchema.d.ts +4 -0
  21. package/example/schemas/todo/TodoSchema/index.d.ts +1 -0
  22. package/example/schemas/todo/index.d.ts +1 -0
  23. package/example/tags/Todo/Todo.d.ts +1 -0
  24. package/example/tags/Todo/index.d.ts +1 -0
  25. package/example/tags/index.d.ts +1 -1
  26. package/handler/handler.d.ts +11 -3
  27. package/handler/handler.es6.js +10 -2
  28. package/handler/handler.js +10 -2
  29. package/hooks/index.d.ts +4 -0
  30. package/hooks/index.es6.js +4 -0
  31. package/hooks/index.js +4 -0
  32. package/hooks/useAction/useAction.es6.js +1 -1
  33. package/hooks/useAction/useAction.js +1 -1
  34. package/hooks/useApi/useApi.d.ts +1 -3
  35. package/hooks/useClientIp/index.d.ts +1 -0
  36. package/hooks/useClientIp/index.es6.js +1 -0
  37. package/hooks/useClientIp/index.js +9 -0
  38. package/hooks/useClientIp/useClientIp.d.ts +1 -0
  39. package/hooks/useClientIp/useClientIp.es6.js +9 -0
  40. package/hooks/useClientIp/useClientIp.js +13 -0
  41. package/hooks/useComponentName/useComponentName.d.ts +1 -1
  42. package/hooks/useEndpoint/useEndpoint.es6.js +3 -1
  43. package/hooks/useEndpoint/useEndpoint.js +3 -1
  44. package/hooks/useObjectSchemaContext/index.d.ts +1 -0
  45. package/hooks/useObjectSchemaContext/index.es6.js +1 -0
  46. package/hooks/useObjectSchemaContext/index.js +10 -0
  47. package/hooks/useObjectSchemaContext/useObjectSchemaContext.d.ts +3 -0
  48. package/hooks/useObjectSchemaContext/useObjectSchemaContext.es6.js +14 -0
  49. package/hooks/useObjectSchemaContext/useObjectSchemaContext.js +19 -0
  50. package/hooks/useRequest/index.es6.js +1 -1
  51. package/hooks/useRequest/index.js +0 -1
  52. package/hooks/useRequest/useRequest.d.ts +1 -4
  53. package/hooks/useRequest/useRequest.es6.js +4 -4
  54. package/hooks/useRequest/useRequest.js +3 -4
  55. package/hooks/useResponse/index.es6.js +1 -1
  56. package/hooks/useResponse/index.js +0 -1
  57. package/hooks/useResponse/useResponse.d.ts +1 -4
  58. package/hooks/useResponse/useResponse.es6.js +4 -4
  59. package/hooks/useResponse/useResponse.js +3 -4
  60. package/hooks/useSchemaType/useSchemaType.d.ts +3 -2
  61. package/hooks/useSchemaType/useSchemaType.es6.js +2 -3
  62. package/hooks/useSchemaType/useSchemaType.js +2 -3
  63. package/hooks/useServer/useServer.d.ts +1 -0
  64. package/hooks/useServer/useServer.es6.js +3 -1
  65. package/hooks/useServer/useServer.js +3 -1
  66. package/hooks/useServerPlugin/index.d.ts +1 -0
  67. package/hooks/useServerPlugin/index.es6.js +1 -0
  68. package/hooks/useServerPlugin/index.js +9 -0
  69. package/hooks/useServerPlugin/useServerPlugin.d.ts +2 -0
  70. package/hooks/useServerPlugin/useServerPlugin.es6.js +13 -0
  71. package/hooks/useServerPlugin/useServerPlugin.js +17 -0
  72. package/hooks/useServerPlugins/index.d.ts +1 -0
  73. package/hooks/useServerPlugins/index.es6.js +1 -0
  74. package/hooks/useServerPlugins/index.js +10 -0
  75. package/hooks/useServerPlugins/useServerPlugins.d.ts +4 -0
  76. package/hooks/useServerPlugins/useServerPlugins.es6.js +14 -0
  77. package/hooks/useServerPlugins/useServerPlugins.js +19 -0
  78. package/index.es6.js +13 -5
  79. package/index.js +24 -6
  80. package/package.json +2 -2
  81. package/plugins/main/api/api.d.ts +2 -0
  82. package/plugins/main/api/api.es6.js +49 -51
  83. package/plugins/main/api/api.js +49 -51
  84. package/plugins/main/endpoint/endpoint.es6.js +4 -1
  85. package/plugins/main/endpoint/endpoint.js +4 -1
  86. package/plugins/main/index.d.ts +1 -1
  87. package/plugins/main/index.es6.js +1 -1
  88. package/plugins/main/index.js +1 -1
  89. package/plugins/main/preset/index.d.ts +1 -0
  90. package/plugins/main/preset/index.es6.js +1 -0
  91. package/{utils/rules/any/any.js → plugins/main/preset/index.js} +4 -4
  92. package/plugins/main/preset/preset.d.ts +3 -0
  93. package/plugins/main/preset/preset.es6.js +13 -0
  94. package/plugins/main/preset/preset.js +21 -0
  95. package/plugins/main/request/request.es6.js +2 -13
  96. package/plugins/main/request/request.js +2 -13
  97. package/plugins/main/response/index.es6.js +1 -1
  98. package/plugins/main/response/index.js +1 -0
  99. package/plugins/main/response/response.d.ts +6 -2
  100. package/plugins/main/response/response.es6.js +16 -8
  101. package/plugins/main/response/response.js +16 -7
  102. package/plugins/main/server/server.d.ts +3 -3
  103. package/plugins/main/server/server.es6.js +29 -7
  104. package/plugins/main/server/server.js +29 -7
  105. package/plugins/main/tag/tag.es6.js +4 -1
  106. package/plugins/main/tag/tag.js +4 -1
  107. package/plugins/request/cms/cms.es6.js +1 -1
  108. package/plugins/request/cms/cms.js +1 -1
  109. package/plugins/request/cookie/cookie.es6.js +3 -19
  110. package/plugins/request/cookie/cookie.js +3 -23
  111. package/plugins/request/proxy/proxy.d.ts +3 -0
  112. package/plugins/request/proxy/proxy.es6.js +4 -1
  113. package/plugins/request/proxy/proxy.js +4 -1
  114. package/plugins/request/redirect/redirect.d.ts +2 -1
  115. package/plugins/request/success/success.d.ts +1 -0
  116. package/plugins/request/success/success.es6.js +13 -4
  117. package/plugins/request/success/success.js +13 -4
  118. package/plugins/schema/any/any.d.ts +5 -0
  119. package/plugins/schema/any/any.es6.js +27 -0
  120. package/plugins/schema/any/any.js +31 -0
  121. package/plugins/schema/boolean/boolean.es6.js +2 -4
  122. package/plugins/schema/boolean/boolean.js +1 -3
  123. package/plugins/schema/field/field.es6.js +3 -5
  124. package/plugins/schema/field/field.js +2 -4
  125. package/plugins/schema/index.d.ts +1 -0
  126. package/plugins/schema/index.es6.js +1 -0
  127. package/plugins/schema/index.js +1 -0
  128. package/plugins/schema/object/object.es6.js +17 -4
  129. package/plugins/schema/object/object.js +17 -4
  130. package/plugins/utils/blacklist/blacklist.d.ts +4 -0
  131. package/plugins/utils/blacklist/blacklist.es6.js +18 -0
  132. package/plugins/utils/blacklist/blacklist.js +22 -0
  133. package/plugins/utils/blacklist/index.d.ts +1 -0
  134. package/plugins/utils/blacklist/index.es6.js +1 -0
  135. package/plugins/utils/blacklist/index.js +9 -0
  136. package/plugins/utils/dts/dts.d.ts +3 -3
  137. package/plugins/utils/dts/dts.es6.js +6 -25
  138. package/plugins/utils/dts/dts.js +5 -29
  139. package/plugins/utils/index.d.ts +3 -0
  140. package/plugins/utils/index.es6.js +3 -0
  141. package/plugins/utils/index.js +3 -0
  142. package/plugins/utils/protection/index.d.ts +1 -0
  143. package/plugins/utils/protection/index.es6.js +1 -0
  144. package/plugins/utils/protection/index.js +9 -0
  145. package/plugins/utils/protection/protection.d.ts +8 -0
  146. package/plugins/utils/protection/protection.es6.js +36 -0
  147. package/plugins/utils/protection/protection.js +40 -0
  148. package/plugins/utils/swagger/swagger.es6.js +10 -12
  149. package/plugins/utils/swagger/swagger.js +10 -12
  150. package/plugins/utils/whitelist/index.d.ts +1 -0
  151. package/plugins/utils/whitelist/index.es6.js +1 -0
  152. package/plugins/utils/whitelist/index.js +9 -0
  153. package/plugins/utils/whitelist/whitelist.d.ts +4 -0
  154. package/plugins/utils/whitelist/whitelist.es6.js +20 -0
  155. package/plugins/utils/whitelist/whitelist.js +24 -0
  156. package/types.d.ts +2 -10
  157. package/utils/action/Action.d.ts +7 -4
  158. package/utils/action/Action.es6.js +35 -11
  159. package/utils/action/Action.js +36 -12
  160. package/utils/generateTypes/generateTypes.d.ts +3 -0
  161. package/utils/generateTypes/generateTypes.es6.js +151 -0
  162. package/utils/generateTypes/generateTypes.js +156 -0
  163. package/utils/generateTypes/generateTypes.test.d.ts +1 -0
  164. package/utils/generateTypes/index.d.ts +1 -0
  165. package/utils/generateTypes/index.es6.js +1 -0
  166. package/utils/generateTypes/index.js +10 -0
  167. package/utils/getEndpoint/getEndpoint.es6.js +2 -2
  168. package/utils/getEndpoint/getEndpoint.js +2 -2
  169. package/utils/index.d.ts +1 -0
  170. package/utils/index.es6.js +1 -0
  171. package/utils/index.js +1 -0
  172. package/utils/rules/index.d.ts +0 -1
  173. package/utils/rules/index.es6.js +0 -1
  174. package/utils/rules/index.js +0 -1
  175. package/utils/rules/objectOf/objectOf.d.ts +1 -1
  176. package/utils/rules/objectOf/objectOf.es6.js +15 -2
  177. package/utils/rules/objectOf/objectOf.js +15 -2
  178. package/example/requests/partners/EditPartner/EditPartner.d.ts +0 -1
  179. package/example/requests/partners/EditPartner/index.d.ts +0 -1
  180. package/example/requests/partners/GetPartner/GetPartner.d.ts +0 -1
  181. package/example/requests/partners/GetPartner/index.d.ts +0 -1
  182. package/example/requests/partners/GetPartners/GetPartners.d.ts +0 -1
  183. package/example/requests/partners/GetPartners/index.d.ts +0 -1
  184. package/example/requests/partners/index.d.ts +0 -3
  185. package/example/schemas/address/AddressSchema/AddressSchema.d.ts +0 -1
  186. package/example/schemas/address/AddressSchema/index.d.ts +0 -1
  187. package/example/schemas/address/index.d.ts +0 -1
  188. package/example/schemas/location/LocationSchema/LocationSchema.d.ts +0 -1
  189. package/example/schemas/location/LocationSchema/index.d.ts +0 -1
  190. package/example/schemas/location/index.d.ts +0 -1
  191. package/example/schemas/partner/EditPartnerSchema/EditPartnerSchema.d.ts +0 -1
  192. package/example/schemas/partner/EditPartnerSchema/index.d.ts +0 -1
  193. package/example/schemas/partner/PartnerSchema/PartnerSchema.d.ts +0 -1
  194. package/example/schemas/partner/PartnerSchema/index.d.ts +0 -1
  195. package/example/schemas/partner/index.d.ts +0 -2
  196. package/example/tags/Partner/Partner.d.ts +0 -1
  197. package/example/tags/Partner/index.d.ts +0 -1
  198. package/plugins/main/fallback/fallback.d.ts +0 -4
  199. package/plugins/main/fallback/fallback.es6.js +0 -19
  200. package/plugins/main/fallback/fallback.js +0 -23
  201. package/plugins/main/fallback/index.d.ts +0 -1
  202. package/plugins/main/fallback/index.es6.js +0 -1
  203. package/plugins/main/fallback/index.js +0 -9
  204. package/utils/rules/any/any.d.ts +0 -1
  205. package/utils/rules/any/any.es6.js +0 -5
  206. /package/{utils/rules → plugins/schema}/any/index.d.ts +0 -0
  207. /package/{utils/rules → plugins/schema}/any/index.es6.js +0 -0
  208. /package/{utils/rules → plugins/schema}/any/index.js +0 -0
package/README.md CHANGED
@@ -46,7 +46,7 @@ Customize
46
46
 
47
47
  [← back](#index)
48
48
 
49
- The simplest way to start working with `@innet/server`, it is `innetjs` usage.
49
+ The simplest way to start working with `@innet/server`, it is [innetjs](https://www.npmjs.com/package/innetjs) usage.
50
50
 
51
51
  ```shell
52
52
  npx innetjs init my-app -t api
@@ -77,6 +77,28 @@ innet(app, server)
77
77
 
78
78
  Here is a **Hello World** example:
79
79
 
80
+ *src/app.tsx*
81
+ ```typescript jsx
82
+ export default (
83
+ <server>
84
+ <request>
85
+ <success>
86
+ Hello World!
87
+ </success>
88
+ </request>
89
+ </server>
90
+ )
91
+ ```
92
+
93
+ *Use `npm start` to run this server.*
94
+
95
+ Open http://localhost:80
96
+ You will see the `Hello Word!` string.
97
+
98
+ ---
99
+
100
+ Here is the simplest [api](#api) example:
101
+
80
102
  *src/app.tsx*
81
103
  ```typescript jsx
82
104
  export default (
@@ -107,7 +129,9 @@ You will see a base Open API JSON structure.
107
129
  [← back](#index)
108
130
 
109
131
  [\<server>](#server)
110
- [\<api>](#api)
132
+ [\<api>](#api)
133
+ [\<request>](#request)
134
+ [\<preset>](#preset)
111
135
 
112
136
  ---
113
137
 
@@ -136,8 +160,8 @@ export default (
136
160
  ```
137
161
 
138
162
  - By default, it uses port `80` for `http` and port `442` for `https`.
139
- - You can use `PORT` environment variable to set it up on CI level.
140
- - [innetjs](https://www.npmjs.com/package/innetjs) allows you to use `PORT` in `.env` file of local environment.
163
+ - You can use `INNET_PORT` environment variable to set it up on CI level.
164
+ - [innetjs](https://www.npmjs.com/package/innetjs) allows you to use `INNET_PORT` in `.env` file of local environment.
141
165
 
142
166
  #### ssl
143
167
 
@@ -155,8 +179,8 @@ export default (
155
179
  )
156
180
  ```
157
181
 
158
- - You can use `SSL_KEY` and `SSL_CRT` environment variables to set it up on CI level.
159
- - [innetjs](https://www.npmjs.com/package/innetjs) allows you to use `SSL_KEY` and `SSL_CRT` in `.env` file.
182
+ - You can use `INNET_SSL_KEY` and `INNET_SSL_CRT` environment variables to set it up on CI level.
183
+ - [innetjs](https://www.npmjs.com/package/innetjs) allows you to use `INNET_SSL_KEY` and `INNET_SSL_CRT` in `.env` file.
160
184
  - You can add `localhost.key` and `localhost.crt` files in your project folder.
161
185
 
162
186
  #### onStart
@@ -206,12 +230,25 @@ export default (
206
230
  )
207
231
  ```
208
232
 
233
+ #### onClose
234
+
235
+ Use `onClose` to handle server close action.
236
+
237
+ *src/app.tsx*
238
+ ```typescript jsx
239
+ export default (
240
+ <server
241
+ onClose={() => console.log('Close')}
242
+ />
243
+ )
244
+ ```
245
+
209
246
  ### \<api>
210
247
 
211
248
  [← back](#main)
212
249
 
213
- `<api>` element MUST be placed in `<server>` element.
214
250
  This element defines a REST API on the server.
251
+ This element MUST be placed in [\<server>](#server) element.
215
252
 
216
253
  #### title
217
254
 
@@ -292,7 +329,7 @@ export default (
292
329
  )
293
330
  ```
294
331
 
295
- *default: 0.0.0*
332
+ *default: `INNET_API_VERSION` || `'0.0.0'`*
296
333
 
297
334
  #### prefix
298
335
 
@@ -309,6 +346,162 @@ export default (
309
346
  )
310
347
  ```
311
348
 
349
+ #### include
350
+
351
+ A regular expression scopes the API.
352
+
353
+ *src/app.tsx*
354
+ ```typescript jsx
355
+ export default (
356
+ <server>
357
+ <api
358
+ include={/^\/(api|openapi)/}
359
+ />
360
+ </server>
361
+ )
362
+ ```
363
+
364
+ #### exclude
365
+
366
+ A regular expression does not scope the API.
367
+
368
+ *src/app.tsx*
369
+ ```typescript jsx
370
+ export default (
371
+ <server>
372
+ <api prefix='/api' />
373
+ <api prefix='/openapi' />
374
+ <api exclude={/^\/(api|openapi)/} />
375
+ </server>
376
+ )
377
+ ```
378
+
379
+ ### \<request>
380
+
381
+ [← back](#main)
382
+
383
+ This element MUST be placed in [\<server>](#server) element.
384
+ It defines run-time call handler for parent element.
385
+
386
+ *src/app.tsx*
387
+ ```typescript jsx
388
+ export default (
389
+ <server>
390
+ <request>
391
+ <error status={404} />
392
+ </request>
393
+ </server>
394
+ )
395
+ ```
396
+ *Any request returns 404*
397
+
398
+ Place [\<request>](#request) in [\<api>](#api) to handle any unknown request in the [\<api>](#api).
399
+
400
+ *src/app.tsx*
401
+ ```typescript jsx
402
+ export default (
403
+ <server>
404
+ <api>
405
+ <request>
406
+ <error status={404} />
407
+ </request>
408
+ </api>
409
+ </server>
410
+ )
411
+ ```
412
+
413
+ Place [\<request>](#request) in [\<endpoint>](#endpoint) to handle the [\<endpoint>](#endpoint) request.
414
+
415
+ *src/app.tsx*
416
+ ```typescript jsx
417
+ export default (
418
+ <server>
419
+ <api>
420
+ <endpoint method='get' path='/my-endpoint'>
421
+ <request>
422
+ <success>
423
+ My Endpoint
424
+ </success>
425
+ </request>
426
+ </endpoint>
427
+ </api>
428
+ <request>
429
+ <success>
430
+ Any other request
431
+ </success>
432
+ </request>
433
+ </server>
434
+ )
435
+ ```
436
+
437
+ You can place a component inside [\<request>](#request).
438
+ The component will run when the request will be triggered.
439
+
440
+ *src/app.tsx*
441
+ ```typescript jsx
442
+ import { GetPartners } from './GetPartners'
443
+
444
+ export default (
445
+ <server>
446
+ <api>
447
+ <endpoint method='get' path='/partners'>
448
+ <request>
449
+ <GetPartners />
450
+ </request>
451
+ </endpoint>
452
+ </api>
453
+ </server>
454
+ )
455
+ ```
456
+
457
+ *src/GetPartners.tsx*
458
+ ```typescript jsx
459
+ export const GetPartners = () => (
460
+ <success>
461
+ {{partners: []}}
462
+ </success>
463
+ )
464
+ ```
465
+
466
+ ### \<preset>
467
+
468
+ [← back](#main)
469
+
470
+ `<preset>` element MUST be placed in `<server>` element.
471
+ This element adds handling of each request.
472
+
473
+ *src/app.tsx*
474
+ ```typescript jsx
475
+ export default (
476
+ <server>
477
+ <preset>
478
+ <header
479
+ key='Test'
480
+ value='Ok'
481
+ />
482
+ </preset>
483
+ </server>
484
+ )
485
+ ```
486
+
487
+ Place the element inside [\<api>](#api) to preset it on the api requests scope.
488
+
489
+ *src/app.tsx*
490
+ ```typescript jsx
491
+ export default (
492
+ <server>
493
+ <api prefix='/api'>
494
+ <preset>
495
+ <header
496
+ key='Cache-Control'
497
+ value='no-cache, no-store, must-revalidate'
498
+ />
499
+ </preset>
500
+ </api>
501
+ </server>
502
+ )
503
+ ```
504
+
312
505
  ## Utils
313
506
 
314
507
  This section contains elements of utils.
@@ -317,101 +510,390 @@ This section contains elements of utils.
317
510
 
318
511
  [\<swagger>](#swagger)
319
512
  [\<dev>](#dev)
320
- [\<dts>](#dts)
513
+ [\<prod>](#prod)
514
+ [\<dts>](#dts)
515
+ [\<blacklist>](#blacklist)
516
+ [\<whitelist>](#whitelist)
517
+ [\<protection>](#protection)
321
518
 
322
519
  ---
323
520
 
324
- ### \<swagger>
521
+ ### \<swagger>
522
+
523
+ [← back](#utils)
524
+
525
+ Use `<swagger>` element to add Swagger UI documentation.
526
+ `<swagger>` element MUST be placed in `<api>` element.
527
+
528
+ *src/app.tsx*
529
+ ```typescript jsx
530
+ export default (
531
+ <server>
532
+ <api>
533
+ <swagger />
534
+ </api>
535
+ </server>
536
+ )
537
+ ```
538
+
539
+ Open http://localhost:80/swagger-ui
540
+ You will see Swagger UI documentation.
541
+
542
+ You can change the Swagger UI URL path by `path` property of `<swagger>` element.
543
+
544
+ *src/app.tsx*
545
+ ```typescript jsx
546
+ export default (
547
+ <server>
548
+ <api>
549
+ <swagger path='/swagger' />
550
+ </api>
551
+ </server>
552
+ )
553
+ ```
554
+
555
+ ### \<dev>
556
+
557
+ [← back](#utils)
558
+
559
+ Everything inside <dev> will work when `NODE_ENV` equals `development`.
560
+
561
+ *src/app.tsx*
562
+ ```typescript jsx
563
+ export default (
564
+ <server>
565
+ <api>
566
+ <dev>
567
+ <swagger />
568
+ </dev>
569
+ </api>
570
+ </server>
571
+ )
572
+ ```
573
+
574
+ ### \<prod>
575
+
576
+ [← back](#utils)
577
+
578
+ Everything inside <prod> will work when `NODE_ENV` equals `production`.
579
+
580
+ *src/app.tsx*
581
+ ```typescript jsx
582
+ export default (
583
+ <server>
584
+ <api>
585
+ <prod>
586
+ <swagger />
587
+ </prod>
588
+ </api>
589
+ </server>
590
+ )
591
+ ```
592
+
593
+ ### \<dts>
594
+
595
+ [← back](#utils)
596
+
597
+ Use `<dts>` element to add types generation.
598
+ `<dts>` element MUST be placed in `<api>` element.
599
+
600
+ *src/app.tsx*
601
+ ```typescript jsx
602
+ export default (
603
+ <server>
604
+ <api>
605
+ <dts />
606
+ </api>
607
+ </server>
608
+ )
609
+ ```
610
+
611
+ You do not need to import types, use `Api` namespace everywhere.
612
+ Here is an example of generated types usage.
613
+
614
+ ```typescript jsx
615
+ import { useParams } from '@innet/server'
616
+
617
+ import { todos } from '../todos'
618
+
619
+ export function DeleteTodo () {
620
+ const { todoId } = useParams<Api.Endpoints['DELETE:/todos/{todoId}']['Params']>()
621
+
622
+ const todoIndex = todos.findIndex(({ id }) => id === todoId)
623
+
624
+ if (todoIndex === -1) {
625
+ return <error code='todoNotFound' status={404} />
626
+ }
627
+
628
+ todos.splice(todoIndex, 1)
629
+
630
+ return <success />
631
+ }
632
+ ```
633
+
634
+ #### path
635
+
636
+ This is a path of api TypeScript types file, `<dts>` generates it.
637
+ `'src/api.d.ts'` by default.
638
+
639
+ *src/app.tsx*
640
+ ```typescript jsx
641
+ export default (
642
+ <server>
643
+ <api>
644
+ <dts path='src/types.d.ts' />
645
+ </api>
646
+ </server>
647
+ )
648
+ ```
649
+
650
+ #### namespace
651
+
652
+ This prop changes namespace for generated types. `'Api'` by default.
653
+
654
+ *src/app.tsx*
655
+ ```typescript jsx
656
+ export default (
657
+ <server>
658
+ <api>
659
+ <dts namespace='API' />
660
+ </api>
661
+ </server>
662
+ )
663
+ ```
664
+
665
+ ### \<blacklist>
666
+
667
+ This element MUST be placed in `<api>` element.
668
+
669
+ [← back](#utils)
670
+
671
+ This element returns own content for a user from IPs list.
672
+
673
+ *src/app.tsx*
674
+ ```typescript jsx
675
+ export default (
676
+ <server>
677
+ <api>
678
+ <blacklist>
679
+ <error />
680
+ </blacklist>
681
+ </api>
682
+ </server>
683
+ )
684
+ ```
685
+
686
+ #### ip
687
+
688
+ `ip` prop sets black IPs. By default, it equals `INNET_BLACKLIST_IP` node environment variable.
689
+
690
+ You can split IPs by `,` char.
691
+
692
+ *src/app.tsx*
693
+ ```typescript jsx
694
+ export default (
695
+ <server>
696
+ <api>
697
+ <blacklist
698
+ ip='0.1.2.3,3.2.1.0'>
699
+ <error />
700
+ </blacklist>
701
+ </api>
702
+ </server>
703
+ )
704
+ ```
705
+
706
+ ### \<whitelist>
707
+
708
+ This element MUST be placed in `<api>` element.
709
+
710
+ [← back](#utils)
711
+
712
+ This element returns own content for a user IP, which is not in a list.
713
+
714
+ *src/app.tsx*
715
+ ```typescript jsx
716
+ export default (
717
+ <server>
718
+ <api>
719
+ <whitelist>
720
+ <error />
721
+ </whitelist>
722
+ </api>
723
+ </server>
724
+ )
725
+ ```
726
+
727
+ #### ip
728
+
729
+ `ip` prop sets white IPs. By default, it equals `INNET_WHITELIST_IP` node environment variable.
730
+
731
+ You can split IPs by `,` char.
732
+
733
+ *src/app.tsx*
734
+ ```typescript jsx
735
+ export default (
736
+ <server>
737
+ <api>
738
+ <whitelist
739
+ ip='0.1.2.3,3.2.1.0'>
740
+ <error />
741
+ </whitelist>
742
+ </api>
743
+ </server>
744
+ )
745
+ ```
746
+
747
+ ### \<protection>
748
+
749
+ This element MUST be placed in `<api>` element.
750
+
751
+ [← back](#utils)
752
+
753
+ This element adds protection page.
754
+ You can use it when you want to protect your application.
755
+
756
+ If protection failed content of the element should be used.
757
+
758
+ *src/app.tsx*
759
+ ```typescript jsx
760
+ export default (
761
+ <server>
762
+ <api>
763
+ <protection>
764
+ <error
765
+ code='protection'
766
+ status='forbidden'
767
+ />
768
+ </protection>
769
+ </api>
770
+ </server>
771
+ )
772
+ ```
773
+
774
+ #### value
325
775
 
326
- [← back](#utils)
776
+ This prop is a secret string of protection value.
777
+ User must provide a protection query param equals the `value`.
327
778
 
328
- Use `<swagger>` element to add Swagger UI documentation.
329
- `<swagger>` element MUST be placed in `<api>` element.
779
+ By default, the value is `undefined` and protection does not work.
780
+ You can use `PROTECTION` env to set default protection `value`.
330
781
 
331
782
  *src/app.tsx*
332
783
  ```typescript jsx
333
784
  export default (
334
785
  <server>
335
786
  <api>
336
- <swagger />
787
+ <protection value='secret'>
788
+ <error
789
+ code='protection'
790
+ status='forbidden'
791
+ />
792
+ </protection>
337
793
  </api>
338
794
  </server>
339
795
  )
340
796
  ```
341
797
 
342
- Open http://localhost:80/swagger-ui
343
- You will see Swagger UI documentation.
798
+ #### maxAge
344
799
 
345
- You can change the Swagger UI URL path by `path` property of `<swagger>` element.
800
+ This prop sets how much time protection is qualified.
801
+
802
+ By default, the prop equals a year.
803
+ You can use `INNET_PROTECTION_MAX_AGE` env to set default `maxAge`.
346
804
 
347
805
  *src/app.tsx*
348
806
  ```typescript jsx
349
807
  export default (
350
808
  <server>
351
809
  <api>
352
- <swagger path='/swagger' />
810
+ <protection
811
+ maxAge={24 * 60 * 60}
812
+ value='secret'>
813
+ <error
814
+ code='protection'
815
+ status='forbidden'
816
+ />
817
+ </protection>
353
818
  </api>
354
819
  </server>
355
820
  )
356
821
  ```
357
822
 
358
- ### \<dev>
823
+ #### excludeIp
359
824
 
360
- [← back](#utils)
825
+ This prop sets a list of IP addresses (split by `,`) to ignore the protection.
361
826
 
362
- Everything inside <dev> will work when `NODE_ENV` equals `development`.
827
+ You can use `INNET_PROTECTED_IP` env to set default `excludeIp`.
363
828
 
364
829
  *src/app.tsx*
365
830
  ```typescript jsx
366
831
  export default (
367
832
  <server>
368
833
  <api>
369
- <dev>
370
- <swagger />
371
- </dev>
834
+ <protection
835
+ excludeIp='0.0.0.0,127.0.0.0'
836
+ value='secret'>
837
+ <error
838
+ code='protection'
839
+ status='forbidden'
840
+ />
841
+ </protection>
372
842
  </api>
373
843
  </server>
374
844
  )
375
845
  ```
376
846
 
377
- ### \<dts>
378
-
379
- [← back](#utils)
847
+ #### cookieKey
380
848
 
381
- Use `<dts>` element to add types generation.
382
- `<dts>` element MUST be placed in `<api>` element.
849
+ This prop sets a cookie field name used to store protection of a user.
383
850
 
384
- `<dts>` has a required prop of `path`. This is a path of api TypeScript types file, `<dts>` generates it.
851
+ By default, it equals `protection`.
852
+ You can use `INNET_PROTECTION_COOKIE_KEY` env to set default `cookieKey`.
385
853
 
386
854
  *src/app.tsx*
387
855
  ```typescript jsx
388
856
  export default (
389
857
  <server>
390
858
  <api>
391
- <dev>
392
- <dts path='src/api.d.ts' />
393
- </dev>
859
+ <protection
860
+ cookieKey='secret'
861
+ value='secret'>
862
+ <error
863
+ code='protection'
864
+ status='forbidden'
865
+ />
866
+ </protection>
394
867
  </api>
395
868
  </server>
396
869
  )
397
870
  ```
398
871
 
399
- > You MUST add some [endpoint](#endpoint) with some schema otherwise you get the `Error: There is no schema in the input contents`.
872
+ #### searchKey
400
873
 
401
- Here is an example of generated types usage.
874
+ This prop sets a search query field name used to check protection.
402
875
 
403
- *src/GetPartner.tsx*
404
- ```typescript jsx
405
- import { useParams } from '@innet/server'
876
+ By default, it equals `protection`.
877
+ You can use `INNET_PROTECTION_SEARCH_KEY` env to set default `searchKey`.
406
878
 
407
- export function GetPartner () {
408
- const { id } = useParams<Paths.Partners$Id.Get.PathParameters>()
409
- return <success>{{ id }}</success>
410
- }
879
+ *src/app.tsx*
880
+ ```typescript jsx
881
+ export default (
882
+ <server>
883
+ <api>
884
+ <protection
885
+ searchKey='secret'
886
+ value='secret'>
887
+ <error
888
+ code='protection'
889
+ status='forbidden'
890
+ />
891
+ </protection>
892
+ </api>
893
+ </server>
894
+ )
411
895
  ```
412
896
 
413
- You do not need to import types, they generate as namespaces.
414
-
415
897
  ## API Info
416
898
 
417
899
  The API information elements are here.
@@ -980,6 +1462,7 @@ This element MUST be placed inside `<endpoint>`.
980
1462
  It defines request body for the endpoint.
981
1463
  `@innet/server` formats and validate the value automatically (real-time).
982
1464
 
1465
+ *src/app.tsx*
983
1466
  ```typescript jsx
984
1467
  return (
985
1468
  <server>
@@ -1013,10 +1496,130 @@ return (
1013
1496
  This element MUST be placed inside `<endpoint>`.
1014
1497
  It defines response body for the endpoint.
1015
1498
 
1499
+ *src/app.tsx*
1500
+ ```typescript jsx
1501
+ return (
1502
+ <server>
1503
+ <api>
1504
+ <endpoint method='get' path='/settings'>
1505
+ <response>
1506
+ <object />
1507
+ </response>
1508
+ </endpoint>
1509
+ </api>
1510
+ </server>
1511
+ )
1512
+ ```
1513
+
1514
+ #### status
1515
+ A status of the `<response>`.
1516
+ Any [HTTP status code](https://swagger.io/specification/#http-codes) can be used as a number of the property.
1517
+
1518
+ By default, `status` equals `'default'`.
1519
+
1520
+ *src/app.tsx*
1521
+ ```typescript jsx
1522
+ return (
1523
+ <server>
1524
+ <api>
1525
+ <endpoint method='get' path='/settings'>
1526
+ <response status={200}>
1527
+ <object />
1528
+ </response>
1529
+ </endpoint>
1530
+ </api>
1531
+ </server>
1532
+ )
1533
+ ```
1534
+
1535
+ To define a range of response codes, this field MAY contain the uppercase wildcard character `X`.
1536
+ For example, `2XX` represents all response codes between \[200-299].
1537
+ Only the following range definitions are allowed: `1XX`, `2XX`, `3XX`, `4XX` and `5XX`.
1538
+
1539
+ *src/app.tsx*
1540
+ ```typescript jsx
1541
+ return (
1542
+ <server>
1543
+ <api>
1544
+ <endpoint method='get' path='/settings'>
1545
+ <response status='2XX'>
1546
+ <object />
1547
+ </response>
1548
+ </endpoint>
1549
+ </api>
1550
+ </server>
1551
+ )
1552
+ ```
1553
+
1554
+ Many number statuses have a string id you can use on the property.
1555
+
1556
+ *src/app.tsx*
1557
+ ```typescript jsx
1558
+ return (
1559
+ <server>
1560
+ <api>
1561
+ <endpoint method='get' path='/settings'>
1562
+ <response status='notFound'>
1563
+ <object />
1564
+ </response>
1565
+ </endpoint>
1566
+ </api>
1567
+ </server>
1568
+ )
1569
+ ```
1570
+
1571
+ You can use many `<response>` elements in an endpoint.
1572
+
1573
+ *src/app.tsx*
1574
+ ```typescript jsx
1575
+ return (
1576
+ <server>
1577
+ <api>
1578
+ <endpoint method='get' path='/settings'>
1579
+ <response status='2XX'>
1580
+ <object />
1581
+ </response>
1582
+ <response status='4XX'>
1583
+ <object>
1584
+ <field key='error'>
1585
+ <string />
1586
+ </field>
1587
+ <field optional key='data'>
1588
+ <object />
1589
+ </field>
1590
+ </object>
1591
+ </response>
1592
+ </endpoint>
1593
+ </api>
1594
+ </server>
1595
+ )
1596
+ ```
1597
+
1598
+ #### type
1599
+ A media type of the `<response>`.
1600
+
1601
+ By default, `type` equals `'application/json'`.
1602
+
1603
+ *src/app.tsx*
1604
+ ```typescript jsx
1605
+ return (
1606
+ <server>
1607
+ <api>
1608
+ <endpoint method='get' path='/hello'>
1609
+ <response type='text/html'>
1610
+ Hello World!
1611
+ </response>
1612
+ </endpoint>
1613
+ </api>
1614
+ </server>
1615
+ )
1616
+ ```
1617
+
1016
1618
  ## Primitive Data
1017
1619
 
1018
1620
  [← back](#index)
1019
1621
 
1622
+ [\<any>](#any)
1020
1623
  [\<null>](#null)
1021
1624
  [\<boolean>](#boolean)
1022
1625
  [\<string>](#string)
@@ -1026,6 +1629,142 @@ It defines response body for the endpoint.
1026
1629
  [\<uuid>](#uuid)
1027
1630
  [\<binary>](#binary)
1028
1631
 
1632
+ ### \<any>
1633
+
1634
+ [← back](#primitive-data)
1635
+
1636
+ The element MUST be placed inside one of [\<response>](#response), [\<param>](#param), [\<body>](#body).
1637
+ It defines `any` value for a parent element.
1638
+ `@innet/server` formats and validate the value automatically (real-time).
1639
+
1640
+ *src/app.tsx*
1641
+ ```typescript jsx
1642
+ export default (
1643
+ <server>
1644
+ <api>
1645
+ <endpoint method='get' path='/todos'>
1646
+ <param
1647
+ in='query'
1648
+ name='search'>
1649
+ <any />
1650
+ </param>
1651
+ </endpoint>
1652
+ </api>
1653
+ </server>
1654
+ )
1655
+ ```
1656
+
1657
+ #### default
1658
+
1659
+ A default value for the `any`.
1660
+
1661
+ *src/app.tsx*
1662
+ ```typescript jsx
1663
+ export default (
1664
+ <server>
1665
+ <api>
1666
+ <endpoint method='get' path='/users'>
1667
+ <param
1668
+ in='query'
1669
+ name='search'>
1670
+ <any default={null} />
1671
+ </param>
1672
+ </endpoint>
1673
+ </api>
1674
+ </server>
1675
+ )
1676
+ ```
1677
+
1678
+ #### example
1679
+
1680
+ An example value.
1681
+
1682
+ *src/app.tsx*
1683
+ ```typescript jsx
1684
+ export default (
1685
+ <server>
1686
+ <api>
1687
+ <endpoint method='get' path='/products'>
1688
+ <param
1689
+ in='query'
1690
+ name='active'>
1691
+ <any example={false} />
1692
+ </param>
1693
+ </endpoint>
1694
+ </api>
1695
+ </server>
1696
+ )
1697
+ ```
1698
+
1699
+ #### description
1700
+
1701
+ A description of the `any`.
1702
+
1703
+ *src/app.tsx*
1704
+ ```typescript jsx
1705
+ export default (
1706
+ <server>
1707
+ <api>
1708
+ <endpoint method='get' path='/products'>
1709
+ <param
1710
+ in='query'
1711
+ name='active'>
1712
+ <any
1713
+ description='Active products param'
1714
+ />
1715
+ </param>
1716
+ </endpoint>
1717
+ </api>
1718
+ </server>
1719
+ )
1720
+ ```
1721
+
1722
+ ### \<null>
1723
+
1724
+ [← back](#primitive-data)
1725
+
1726
+ The element MUST be placed inside one of [\<response>](#response), [\<param>](#param), [\<body>](#body).
1727
+ It defines `null` value for a parent element.
1728
+ `@innet/server` formats and validate the value automatically (real-time).
1729
+
1730
+ *src/app.tsx*
1731
+ ```typescript jsx
1732
+ export default (
1733
+ <server>
1734
+ <api>
1735
+ <endpoint method='get' path='/todos'>
1736
+ <param
1737
+ in='query'
1738
+ name='search'>
1739
+ <null />
1740
+ </param>
1741
+ </endpoint>
1742
+ </api>
1743
+ </server>
1744
+ )
1745
+ ```
1746
+
1747
+ #### description
1748
+
1749
+ A description of the `null`.
1750
+
1751
+ *src/app.tsx*
1752
+ ```typescript jsx
1753
+ export default (
1754
+ <server>
1755
+ <api>
1756
+ <endpoint method='get' path='/products'>
1757
+ <param
1758
+ in='query'
1759
+ name='active'>
1760
+ <null description='FIXME!' />
1761
+ </param>
1762
+ </endpoint>
1763
+ </api>
1764
+ </server>
1765
+ )
1766
+ ```
1767
+
1029
1768
  ### \<boolean>
1030
1769
 
1031
1770
  [← back](#primitive-data)
@@ -2306,7 +3045,9 @@ export default (
2306
3045
  <api>
2307
3046
  <endpoint method='post' path='/users'>
2308
3047
  <body>
2309
- <object />
3048
+ <object>
3049
+ <string />
3050
+ </object>
2310
3051
  </body>
2311
3052
  </endpoint>
2312
3053
  </api>
@@ -2385,7 +3126,7 @@ The element MUST be placed inside [\<object>](#object).
2385
3126
  It defines a `field` of an `object` value for a parent element.
2386
3127
  `@innet/server` formats and validate the value automatically (real-time).
2387
3128
 
2388
- `key` is REQUIRED prop of `<field>`, it defines a field name of the `<object>`.
3129
+ `key` is REQUIRED prop of `<field>`, it defines a field name of the [\<object>](#object).
2389
3130
 
2390
3131
  *src/app.tsx*
2391
3132
  ```typescript jsx
@@ -2435,12 +3176,7 @@ Next elements relate to run-time action.
2435
3176
  This action calls on user request.
2436
3177
 
2437
3178
  [← back](#index)
2438
-
2439
- Parent
2440
- [\<fallback>](#fallback)
2441
- [\<request>](#request)
2442
-
2443
- Children
3179
+
2444
3180
  [\<success>](#success)
2445
3181
  [\<error>](#error)
2446
3182
  [\<proxy>](#proxy)
@@ -2452,94 +3188,6 @@ Children
2452
3188
 
2453
3189
  ---
2454
3190
 
2455
- ### \<fallback>
2456
-
2457
- [← back](#run-time)
2458
-
2459
- By default, `<api>` server returns 404 with empty body.
2460
- [\<fallback>](#fallback) element defines default server response.
2461
- This element MUST be placed in `<api>`.
2462
- You MUST use one [\<fallback>](#fallback) per `<api>`.
2463
- Can contain elements available inside [\<request>](#request).
2464
-
2465
- *src/app.tsx*
2466
- ```typescript jsx
2467
- export default (
2468
- <server>
2469
- <api>
2470
- <fallback>
2471
- <error
2472
- code='unknownEndpoint'
2473
- />
2474
- </fallback>
2475
- </api>
2476
- </server>
2477
- )
2478
- ```
2479
-
2480
- If you open the application on any URL except for `/`, you can see the next response.
2481
-
2482
- ```json
2483
- {
2484
- "error": "unknownEndpoint"
2485
- }
2486
- ```
2487
-
2488
- The next elements are placed in [\<request>](#request) or [\<fallback>](#fallback)
2489
-
2490
- ### \<request>
2491
-
2492
- [← back](#run-time)
2493
-
2494
- This element MUST be placed in `<endpoint>` element.
2495
- It defines run-time call handler for the endpoint.
2496
-
2497
- *src/app.tsx*
2498
- ```typescript jsx
2499
- export default (
2500
- <server>
2501
- <api>
2502
- <endpoint method='get' path='/partners'>
2503
- <request>
2504
- <success>
2505
- {{partners: []}}
2506
- </success>
2507
- </request>
2508
- </endpoint>
2509
- </api>
2510
- </server>
2511
- )
2512
- ```
2513
-
2514
- You can place a component inside it.
2515
- The component will run when the endpoint will be triggered.
2516
-
2517
- *src/app.tsx*
2518
- ```typescript jsx
2519
- import { GetPartners } from './GetPartners'
2520
-
2521
- export default (
2522
- <server>
2523
- <api>
2524
- <endpoint method='get' path='/partners'>
2525
- <request>
2526
- <GetPartners />
2527
- </request>
2528
- </endpoint>
2529
- </api>
2530
- </server>
2531
- )
2532
- ```
2533
-
2534
- *src/GetPartners.tsx*
2535
- ```typescript jsx
2536
- export const GetPartners = () => (
2537
- <success>
2538
- {{partners: []}}
2539
- </success>
2540
- )
2541
- ```
2542
-
2543
3191
  ### \<success>
2544
3192
 
2545
3193
  [← back](#run-time)
@@ -2550,11 +3198,9 @@ This is a base element to return a success data.
2550
3198
  ```typescript jsx
2551
3199
  export default (
2552
3200
  <server>
2553
- <api>
2554
- <fallback>
2555
- <success />
2556
- </fallback>
2557
- </api>
3201
+ <response>
3202
+ <success />
3203
+ </response>
2558
3204
  </server>
2559
3205
  )
2560
3206
  ```
@@ -2569,13 +3215,11 @@ const data = {...}
2569
3215
 
2570
3216
  export default (
2571
3217
  <server>
2572
- <api>
2573
- <fallback>
2574
- <success>
2575
- {data}
2576
- </success>
2577
- </fallback>
2578
- </api>
3218
+ <response>
3219
+ <success>
3220
+ {data}
3221
+ </success>
3222
+ </response>
2579
3223
  </server>
2580
3224
  )
2581
3225
  ```
@@ -2592,13 +3236,11 @@ const data = {...}
2592
3236
 
2593
3237
  export default (
2594
3238
  <server>
2595
- <api>
2596
- <fallback>
2597
- <success status='created'>
2598
- {data}
2599
- </success>
2600
- </fallback>
2601
- </api>
3239
+ <response>
3240
+ <success status='created'>
3241
+ {data}
3242
+ </success>
3243
+ </response>
2602
3244
  </server>
2603
3245
  )
2604
3246
  ```
@@ -2613,13 +3255,29 @@ const data = {...}
2613
3255
 
2614
3256
  export default (
2615
3257
  <server>
2616
- <api>
2617
- <fallback>
2618
- <success status={201}>
2619
- {data}
2620
- </success>
2621
- </fallback>
2622
- </api>
3258
+ <response>
3259
+ <success status={201}>
3260
+ {data}
3261
+ </success>
3262
+ </response>
3263
+ </server>
3264
+ )
3265
+ ```
3266
+
3267
+ #### contentType
3268
+
3269
+ This props sets response content type.
3270
+ By default, it checks children element to define the prop.
3271
+
3272
+ *src/app.tsx*
3273
+ ```typescript jsx
3274
+ export default (
3275
+ <server>
3276
+ <response>
3277
+ <success contentType='text/html'>
3278
+ Hello World!
3279
+ </success>
3280
+ </response>
2623
3281
  </server>
2624
3282
  )
2625
3283
  ```
@@ -2629,17 +3287,15 @@ export default (
2629
3287
  [← back](#run-time)
2630
3288
 
2631
3289
  Returns an error.
2632
- This element MUST be placed in [\<request>](#request) or [\<fallback>](#fallback).
3290
+ This element MUST be placed in [\<request>](#request) or [\<response>](#response).
2633
3291
 
2634
3292
  *src/app.tsx*
2635
3293
  ```typescript jsx
2636
3294
  export default (
2637
3295
  <server>
2638
- <api>
2639
- <fallback>
2640
- <error />
2641
- </fallback>
2642
- </api>
3296
+ <response>
3297
+ <error />
3298
+ </response>
2643
3299
  </server>
2644
3300
  )
2645
3301
  ```
@@ -2652,13 +3308,11 @@ const data = {...}
2652
3308
 
2653
3309
  export default (
2654
3310
  <server>
2655
- <api>
2656
- <fallback>
2657
- <error>
2658
- {data}
2659
- </error>
2660
- </fallback>
2661
- </api>
3311
+ <response>
3312
+ <error>
3313
+ {data}
3314
+ </error>
3315
+ </response>
2662
3316
  </server>
2663
3317
  )
2664
3318
  ```
@@ -2674,13 +3328,11 @@ const data = {
2674
3328
 
2675
3329
  export default (
2676
3330
  <server>
2677
- <api>
2678
- <fallback>
2679
- <error status='notFound'>
2680
- {data}
2681
- </error>
2682
- </fallback>
2683
- </api>
3331
+ <response>
3332
+ <error status='notFound'>
3333
+ {data}
3334
+ </error>
3335
+ </response>
2684
3336
  </server>
2685
3337
  )
2686
3338
  ```
@@ -2695,13 +3347,11 @@ const data = {
2695
3347
 
2696
3348
  export default (
2697
3349
  <server>
2698
- <api>
2699
- <fallback>
2700
- <error status={404}>
2701
- {data}
2702
- </error>
2703
- </fallback>
2704
- </api>
3350
+ <response>
3351
+ <error status={404}>
3352
+ {data}
3353
+ </error>
3354
+ </response>
2705
3355
  </server>
2706
3356
  )
2707
3357
  ```
@@ -2729,15 +3379,13 @@ const data = {
2729
3379
 
2730
3380
  export default (
2731
3381
  <server>
2732
- <api>
2733
- <fallback>
2734
- <error
2735
- code='noUser'
2736
- status='notFound'>
2737
- {data}
2738
- </error>
2739
- </fallback>
2740
- </api>
3382
+ <response>
3383
+ <error
3384
+ code='noUser'
3385
+ status='notFound'>
3386
+ {data}
3387
+ </error>
3388
+ </response>
2741
3389
  </server>
2742
3390
  )
2743
3391
  ```
@@ -2765,7 +3413,7 @@ There are some default errors:
2765
3413
 
2766
3414
  [← back](#run-time)
2767
3415
 
2768
- MUST be placed in [\<request>](#request) or [\<fallback>](#fallback).
3416
+ MUST be placed in [\<request>](#request) or [\<response>](#response).
2769
3417
 
2770
3418
  You can easy proxy endpoints to another server/service.
2771
3419
 
@@ -2781,10 +3429,10 @@ export default (
2781
3429
  <proxy to='https://...' />
2782
3430
  </request>
2783
3431
  </endpoint>
2784
- <fallback>
2785
- <proxy to='https://...' />
2786
- </fallback>
2787
3432
  </api>
3433
+ <response>
3434
+ <proxy to='https://...' />
3435
+ </response>
2788
3436
  </server>
2789
3437
  )
2790
3438
  ```
@@ -2793,7 +3441,7 @@ export default (
2793
3441
 
2794
3442
  [← back](#run-time)
2795
3443
 
2796
- MUST be placed in [\<request>](#request) or [\<fallback>](#fallback).
3444
+ MUST be placed in [\<request>](#request) or [\<response>](#response).
2797
3445
 
2798
3446
  You can redirect users to another resource. It adds `Cache-Control` header by default.
2799
3447
 
@@ -2809,10 +3457,10 @@ export default (
2809
3457
  <redirect to='https://...' />
2810
3458
  </request>
2811
3459
  </endpoint>
2812
- <fallback>
2813
- <redirect to='https://...' />
2814
- </fallback>
2815
3460
  </api>
3461
+ <response>
3462
+ <redirect to='https://...' />
3463
+ </response>
2816
3464
  </server>
2817
3465
  )
2818
3466
  ```
@@ -2837,13 +3485,13 @@ export default (
2837
3485
  />
2838
3486
  </request>
2839
3487
  </endpoint>
2840
- <fallback>
2841
- <redirect
2842
- status={303}
2843
- to='https://...'
2844
- />
2845
- </fallback>
2846
3488
  </api>
3489
+ <response>
3490
+ <redirect
3491
+ status={303}
3492
+ to='https://...'
3493
+ />
3494
+ </response>
2847
3495
  </server>
2848
3496
  )
2849
3497
  ```
@@ -2852,7 +3500,7 @@ export default (
2852
3500
 
2853
3501
  [← back](#run-time)
2854
3502
 
2855
- MUST be placed in [\<request>](#request) or [\<fallback>](#fallback).
3503
+ MUST be placed in [\<request>](#request) or [\<response>](#response).
2856
3504
 
2857
3505
  `<cms>` helps to return files from a folder by path. It checks files run-time on the server.
2858
3506
 
@@ -2860,18 +3508,16 @@ MUST be placed in [\<request>](#request) or [\<fallback>](#fallback).
2860
3508
  ```typescript jsx
2861
3509
  export default (
2862
3510
  <server>
2863
- <api>
2864
- <fallback>
2865
- <cms />
2866
- </fallback>
2867
- </api>
3511
+ <response>
3512
+ <cms />
3513
+ </response>
2868
3514
  </server>
2869
3515
  )
2870
3516
  ```
2871
3517
 
2872
3518
  #### dir
2873
3519
 
2874
- By default, it looks at project folder.
3520
+ By default, it equals `INNET_CMS_DIR` node env variable or the project folder.
2875
3521
  If you try the previous example on [http://localhost/package.json](http://localhost/package.json)
2876
3522
  you get the project `package.json` file.
2877
3523
 
@@ -2881,11 +3527,9 @@ You can change root folder by `dir` property.
2881
3527
  ```typescript jsx
2882
3528
  export default (
2883
3529
  <server>
2884
- <api>
2885
- <fallback>
2886
- <cms dir='src' />
2887
- </fallback>
2888
- </api>
3530
+ <response>
3531
+ <cms dir='src' />
3532
+ </response>
2889
3533
  </server>
2890
3534
  )
2891
3535
  ```
@@ -2896,15 +3540,16 @@ you get the index file in `src` folder.
2896
3540
  #### prefix
2897
3541
 
2898
3542
  `<cms>` matches full `path`, you should take it into account if you add `prefix` on `<api>`.
3543
+ By default, it equals `INNET_CMS_PREFIX` node env variable or `/`.
2899
3544
 
2900
3545
  *src/app.tsx*
2901
3546
  ```typescript jsx
2902
3547
  export default (
2903
3548
  <server>
2904
3549
  <api prefix='/src'>
2905
- <fallback>
3550
+ <response>
2906
3551
  <cms />
2907
- </fallback>
3552
+ </response>
2908
3553
  </api>
2909
3554
  </server>
2910
3555
  )
@@ -2920,9 +3565,9 @@ You can reduce the path for matching by prefix property of `<cms>`.
2920
3565
  export default (
2921
3566
  <server>
2922
3567
  <api prefix='/api'>
2923
- <fallback>
3568
+ <response>
2924
3569
  <cms prefix='/api' />
2925
- </fallback>
3570
+ </response>
2926
3571
  </api>
2927
3572
  </server>
2928
3573
  )
@@ -2938,13 +3583,11 @@ You can handle if a file was not found by children elements of `<cms>`.
2938
3583
  ```typescript jsx
2939
3584
  export default (
2940
3585
  <server>
2941
- <api prefix='/src'>
2942
- <fallback>
2943
- <cms>
2944
- <error status={404} />
2945
- </cms>
2946
- </fallback>
2947
- </api>
3586
+ <response>
3587
+ <cms>
3588
+ <error status={404} />
3589
+ </cms>
3590
+ </response>
2948
3591
  </server>
2949
3592
  )
2950
3593
  ```
@@ -2953,7 +3596,7 @@ export default (
2953
3596
 
2954
3597
  [← back](#run-time)
2955
3598
 
2956
- It returns a file. MUST be placed in [\<request>](#request) or [\<fallback>](#fallback).
3599
+ It returns a file. MUST be placed in [\<request>](#request) or [\<response>](#response).
2957
3600
 
2958
3601
  It adds `Content-Length` and `Content-Type` automatically.
2959
3602
 
@@ -2963,13 +3606,9 @@ It has a REQUIRED property of `path`.
2963
3606
  ```typescript jsx
2964
3607
  export default (
2965
3608
  <server>
2966
- <api>
2967
- <fallback>
2968
- <file
2969
- path='package.json'
2970
- />
2971
- </fallback>
2972
- </api>
3609
+ <response>
3610
+ <file path='package.json' />
3611
+ </response>
2973
3612
  </server>
2974
3613
  )
2975
3614
  ```
@@ -2984,20 +3623,18 @@ You can handle if a file was not found by children elements of `<file>`.
2984
3623
  ```typescript jsx
2985
3624
  export default (
2986
3625
  <server>
2987
- <api prefix='/src'>
2988
- <fallback>
2989
- <file path='file_is_not_exist.txt'>
2990
- <error status={404} />
2991
- </file>
2992
- </fallback>
2993
- </api>
3626
+ <response>
3627
+ <file path='file_is_not_exist.txt'>
3628
+ <error status={404} />
3629
+ </file>
3630
+ </response>
2994
3631
  </server>
2995
3632
  )
2996
3633
  ```
2997
3634
 
2998
3635
  ### \<header>
2999
3636
 
3000
- MUST be placed in [\<request>](#request) or [\<fallback>](#fallback).
3637
+ MUST be placed in [\<request>](#request) or [\<response>](#response).
3001
3638
 
3002
3639
  [← back](#run-time)
3003
3640
 
@@ -3007,22 +3644,20 @@ You can add an HTTP header into response by `<header>` element.
3007
3644
  ```typescript jsx
3008
3645
  export default (
3009
3646
  <server>
3010
- <api prefix='/src'>
3011
- <fallback>
3012
- <header
3013
- key='Cache-Control'
3014
- value='no-cache, no-store, must-revalidate'
3015
- />
3016
- <success />
3017
- </fallback>
3018
- </api>
3647
+ <response>
3648
+ <header
3649
+ key='Cache-Control'
3650
+ value='no-cache, no-store, must-revalidate'
3651
+ />
3652
+ <success />
3653
+ </response>
3019
3654
  </server>
3020
3655
  )
3021
3656
  ```
3022
3657
 
3023
3658
  ### \<cookie>
3024
3659
 
3025
- MUST be placed in [\<request>](#request) or [\<fallback>](#fallback).
3660
+ MUST be placed in [\<request>](#request) or [\<response>](#response).
3026
3661
 
3027
3662
  [← back](#run-time)
3028
3663
 
@@ -3032,18 +3667,16 @@ You can add/remove a cookie into response by `<cookie>` element.
3032
3667
  ```typescript jsx
3033
3668
  export default (
3034
3669
  <server>
3035
- <api prefix='/src'>
3036
- <fallback>
3037
- <cookie
3038
- key='token'
3039
- value='...'
3040
- />
3041
- <cookie
3042
- key='removedCookie'
3043
- />
3044
- <success />
3045
- </fallback>
3046
- </api>
3670
+ <response>
3671
+ <cookie
3672
+ key='token'
3673
+ value='...'
3674
+ />
3675
+ <cookie
3676
+ key='removedCookie'
3677
+ />
3678
+ <success />
3679
+ </response>
3047
3680
  </server>
3048
3681
  )
3049
3682
  ```
@@ -3057,16 +3690,14 @@ By default, no domain is set, and most clients will consider the cookie to apply
3057
3690
  ```typescript jsx
3058
3691
  export default (
3059
3692
  <server>
3060
- <api prefix='/src'>
3061
- <fallback>
3062
- <cookie
3063
- domain='.example.com'
3064
- key='token'
3065
- value='...'
3066
- />
3067
- <success />
3068
- </fallback>
3069
- </api>
3693
+ <response>
3694
+ <cookie
3695
+ domain='.example.com'
3696
+ key='token'
3697
+ value='...'
3698
+ />
3699
+ <success />
3700
+ </response>
3070
3701
  </server>
3071
3702
  )
3072
3703
  ```
@@ -3085,16 +3716,14 @@ Note the [cookie storage model specification](https://datatracker.ietf.org/doc/h
3085
3716
  ```typescript jsx
3086
3717
  export default (
3087
3718
  <server>
3088
- <api prefix='/src'>
3089
- <fallback>
3090
- <cookie
3091
- expires={new Date('2050-01-01')}
3092
- key='token'
3093
- value='...'
3094
- />
3095
- <success />
3096
- </fallback>
3097
- </api>
3719
+ <response>
3720
+ <cookie
3721
+ expires={new Date('2050-01-01')}
3722
+ key='token'
3723
+ value='...'
3724
+ />
3725
+ <success />
3726
+ </response>
3098
3727
  </server>
3099
3728
  )
3100
3729
  ```
@@ -3108,16 +3737,14 @@ Note be careful when setting this to true, as compliant clients will not allow c
3108
3737
  ```typescript jsx
3109
3738
  export default (
3110
3739
  <server>
3111
- <api prefix='/src'>
3112
- <fallback>
3113
- <cookie
3114
- httpOnly
3115
- key='token'
3116
- value='...'
3117
- />
3118
- <success />
3119
- </fallback>
3120
- </api>
3740
+ <response>
3741
+ <cookie
3742
+ httpOnly
3743
+ key='token'
3744
+ value='...'
3745
+ />
3746
+ <success />
3747
+ </response>
3121
3748
  </server>
3122
3749
  )
3123
3750
  ```
@@ -3131,17 +3758,15 @@ Note the [cookie storage model specification](https://datatracker.ietf.org/doc/h
3131
3758
  ```typescript jsx
3132
3759
  export default (
3133
3760
  <server>
3134
- <api prefix='/src'>
3135
- <fallback>
3136
- <cookie
3137
- httpOnly
3138
- maxAge={9999}
3139
- key='token'
3140
- value='...'
3141
- />
3142
- <success />
3143
- </fallback>
3144
- </api>
3761
+ <response>
3762
+ <cookie
3763
+ httpOnly
3764
+ maxAge={9999}
3765
+ key='token'
3766
+ value='...'
3767
+ />
3768
+ <success />
3769
+ </response>
3145
3770
  </server>
3146
3771
  )
3147
3772
  ```
@@ -3155,18 +3780,16 @@ By default, the path is considered the “default path”.
3155
3780
  ```typescript jsx
3156
3781
  export default (
3157
3782
  <server>
3158
- <api prefix='/src'>
3159
- <fallback>
3160
- <cookie
3161
- httpOnly
3162
- maxAge={9999}
3163
- path='/src'
3164
- key='token'
3165
- value='...'
3166
- />
3167
- <success />
3168
- </fallback>
3169
- </api>
3783
+ <response>
3784
+ <cookie
3785
+ httpOnly
3786
+ maxAge={9999}
3787
+ path='/src'
3788
+ key='token'
3789
+ value='...'
3790
+ />
3791
+ <success />
3792
+ </response>
3170
3793
  </server>
3171
3794
  )
3172
3795
  ```
@@ -3185,18 +3808,16 @@ note This is an attribute that has not yet been fully standardized, and may chan
3185
3808
  ```typescript jsx
3186
3809
  export default (
3187
3810
  <server>
3188
- <api prefix='/src'>
3189
- <fallback>
3190
- <cookie
3191
- httpOnly
3192
- priority='high'
3193
- path='/src'
3194
- key='token'
3195
- value='...'
3196
- />
3197
- <success />
3198
- </fallback>
3199
- </api>
3811
+ <response>
3812
+ <cookie
3813
+ httpOnly
3814
+ priority='high'
3815
+ path='/src'
3816
+ key='token'
3817
+ value='...'
3818
+ />
3819
+ <success />
3820
+ </response>
3200
3821
  </server>
3201
3822
  )
3202
3823
  ```
@@ -3218,19 +3839,17 @@ This also means many clients may ignore this attribute until they understand it.
3218
3839
  ```typescript jsx
3219
3840
  export default (
3220
3841
  <server>
3221
- <api prefix='/src'>
3222
- <fallback>
3223
- <cookie
3224
- httpOnly
3225
- sameSite
3226
- priority='high'
3227
- path='/src'
3228
- key='token'
3229
- value='...'
3230
- />
3231
- <success />
3232
- </fallback>
3233
- </api>
3842
+ <response>
3843
+ <cookie
3844
+ httpOnly
3845
+ sameSite
3846
+ priority='high'
3847
+ path='/src'
3848
+ key='token'
3849
+ value='...'
3850
+ />
3851
+ <success />
3852
+ </response>
3234
3853
  </server>
3235
3854
  )
3236
3855
  ```
@@ -3247,17 +3866,15 @@ Note be careful when setting this to true, as compliant clients will not send th
3247
3866
  ```typescript jsx
3248
3867
  export default (
3249
3868
  <server>
3250
- <api prefix='/src'>
3251
- <fallback>
3252
- <cookie
3253
- httpOnly
3254
- secure
3255
- key='token'
3256
- value='...'
3257
- />
3258
- <success />
3259
- </fallback>
3260
- </api>
3869
+ <response>
3870
+ <cookie
3871
+ httpOnly
3872
+ secure
3873
+ key='token'
3874
+ value='...'
3875
+ />
3876
+ <success />
3877
+ </response>
3261
3878
  </server>
3262
3879
  )
3263
3880
  ```
@@ -3290,14 +3907,12 @@ import { SetToken } from './SetToken'
3290
3907
 
3291
3908
  export default (
3292
3909
  <server>
3293
- <api prefix='/src'>
3294
- <fallback>
3295
- <SetToken
3296
- value='...'
3297
- />
3298
- <success />
3299
- </fallback>
3300
- </api>
3910
+ <response>
3911
+ <SetToken
3912
+ value='...'
3913
+ />
3914
+ <success />
3915
+ </response>
3301
3916
  </server>
3302
3917
  )
3303
3918
  ```
@@ -3310,7 +3925,7 @@ Hook functions give you all features to control parent element functionality.
3310
3925
 
3311
3926
  [← back](#index)
3312
3927
 
3313
- [useServer](#useserver)
3928
+ Real-time
3314
3929
  [useRequest](#userequest)
3315
3930
  [useResponse](#useresponse)
3316
3931
  [useHeaders](#useheaders)
@@ -3319,35 +3934,22 @@ Hook functions give you all features to control parent element functionality.
3319
3934
  [useParams](#useparams)
3320
3935
  [useSearch](#usesearch)
3321
3936
  [useBody](#usebody)
3937
+ [useClientIp](#useclientip)
3322
3938
 
3323
- ---
3324
-
3325
- ### useServer
3326
-
3327
- [← back](#hooks)
3328
-
3329
- This hook MUST be used in a component placed in `<server>`.
3330
- This hook returns current http(s) server instance.
3331
-
3332
- *src/Component.tsx*
3333
-
3334
- ```typescript jsx
3335
- import { useServer } from '@innet/sever'
3336
-
3337
- export function Component () {
3338
- const server = useServer()
3939
+ Server start
3940
+ [useServerPlugin](#useserverplugin)
3339
3941
 
3340
- console.log(server)
3942
+ Both
3943
+ [useServer](#useserver)
3944
+ [useComponentName](#usecomponentname)
3341
3945
 
3342
- return <success />
3343
- }
3344
- ```
3946
+ ---
3345
3947
 
3346
3948
  ### useRequest
3347
3949
 
3348
3950
  [← back](#hooks)
3349
3951
 
3350
- This hook MUST be used in a component placed in [\<request>](#request) or [\<fallback>](#fallback).
3952
+ This hook MUST be used in a component placed in [\<request>](#request) or [\<response>](#response).
3351
3953
  This hook returns current request instance.
3352
3954
 
3353
3955
  *src/Component.tsx*
@@ -3368,7 +3970,7 @@ export function Component () {
3368
3970
 
3369
3971
  [← back](#hooks)
3370
3972
 
3371
- This hook MUST be used in a component placed in [\<request>](#request) or [\<fallback>](#fallback).
3973
+ This hook MUST be used in a component placed in [\<request>](#request) or [\<response>](#response).
3372
3974
  This hook returns current response instance.
3373
3975
 
3374
3976
  *src/Component.tsx*
@@ -3389,7 +3991,7 @@ export function Component () {
3389
3991
 
3390
3992
  [← back](#hooks)
3391
3993
 
3392
- This hook MUST be used in a component placed in [\<request>](#request) or [\<fallback>](#fallback).
3994
+ This hook MUST be used in a component placed in [\<request>](#request) or [\<response>](#response).
3393
3995
  This hook returns current request headers object.
3394
3996
 
3395
3997
  *src/Component.tsx*
@@ -3408,7 +4010,7 @@ export function Component () {
3408
4010
 
3409
4011
  [← back](#hooks)
3410
4012
 
3411
- This hook MUST be used in a component placed in [\<request>](#request) or [\<fallback>](#fallback).
4013
+ This hook MUST be used in a component placed in [\<request>](#request) or [\<response>](#response).
3412
4014
  This hook returns current request cookies object.
3413
4015
 
3414
4016
  *src/Component.tsx*
@@ -3427,7 +4029,7 @@ export function Component () {
3427
4029
 
3428
4030
  [← back](#hooks)
3429
4031
 
3430
- This hook MUST be used in a component placed in [\<request>](#request) or [\<fallback>](#fallback).
4032
+ This hook MUST be used in a component placed in [\<request>](#request) or [\<response>](#response).
3431
4033
  This hook returns current request URL path as a `string`.
3432
4034
 
3433
4035
  *src/Component.tsx*
@@ -3446,7 +4048,7 @@ export function Component () {
3446
4048
 
3447
4049
  [← back](#hooks)
3448
4050
 
3449
- This hook MUST be used in a component placed in [\<request>](#request) or [\<fallback>](#fallback).
4051
+ This hook MUST be used in a component placed in [\<request>](#request) or [\<response>](#response).
3450
4052
  This hook returns an object of URL params you set by [\<param>](#param).
3451
4053
 
3452
4054
  *src/Component.tsx*
@@ -3464,7 +4066,7 @@ export function Component () {
3464
4066
 
3465
4067
  [← back](#hooks)
3466
4068
 
3467
- This hook MUST be used in a component placed in [\<request>](#request) or [\<fallback>](#fallback).
4069
+ This hook MUST be used in a component placed in [\<request>](#request) or [\<response>](#response).
3468
4070
  This hook returns an object of URL query params.
3469
4071
 
3470
4072
  *src/Component.tsx*
@@ -3482,7 +4084,7 @@ export function Component () {
3482
4084
 
3483
4085
  [← back](#hooks)
3484
4086
 
3485
- This hook MUST be used in a component placed in [\<request>](#request) or [\<fallback>](#fallback).
4087
+ This hook MUST be used in a component placed in [\<request>](#request) or [\<response>](#response).
3486
4088
  This hook returns current request body.
3487
4089
 
3488
4090
  *src/Component.tsx*
@@ -3496,6 +4098,106 @@ export function Component () {
3496
4098
  }
3497
4099
  ```
3498
4100
 
4101
+ ### useClientIp
4102
+
4103
+ [← back](#hooks)
4104
+
4105
+ This hook returns request user IP.
4106
+ This hook MUST be used in a component placed in [\<request>](#request) or [\<response>](#response).
4107
+
4108
+ *src/Component.tsx*
4109
+ ```typescript jsx
4110
+ import { useClientIp } from '@innet/sever'
4111
+
4112
+ export function Component () {
4113
+ const ip = useClientIp()
4114
+
4115
+ return <success>{{ ip }}</success>
4116
+ }
4117
+ ```
4118
+
4119
+ ### useServerPlugin
4120
+
4121
+ [← back](#hooks)
4122
+
4123
+ This hook adds a request plugin function.
4124
+ The function runs before check endpoints.
4125
+ If the function returns `true` the request handling stops, and you get full control over the request.
4126
+
4127
+ This hook MUST be used in a component placed in [\<server>](#server).
4128
+
4129
+ *src/SecretEndpoint.tsx*
4130
+ ```typescript jsx
4131
+ import { useRequestPlugin, useAction } from '@innet/sever'
4132
+
4133
+ export function SecretEndpoint () {
4134
+ useServerPlugin(() => {
4135
+ const action = useAction()
4136
+
4137
+ if (action.path.startsWith('/secret-endpoint')) {
4138
+ return <success>A secret message</success>
4139
+ }
4140
+ })
4141
+ }
4142
+ ```
4143
+
4144
+ Then use the plugin in [\<server>](#server) or [\<api>](#api).
4145
+
4146
+ *src/app.tsx*
4147
+ ```typescript jsx
4148
+ import { SecretEndpoint } from './SecretEndpoint'
4149
+
4150
+ export default (
4151
+ <server>
4152
+ <SecretEndpoint />
4153
+ <response>
4154
+ <error />
4155
+ </response>
4156
+ </server>
4157
+ )
4158
+ ```
4159
+
4160
+ Any endpoint returns an error except for `/secret-endpoint`.
4161
+ Elements order does not matter.
4162
+
4163
+ ### useServer
4164
+
4165
+ [← back](#hooks)
4166
+
4167
+ This hook MUST be used in a component placed in [\<server>](#server).
4168
+ This hook returns current http(s) server instance.
4169
+
4170
+ *src/Component.tsx*
4171
+ ```typescript jsx
4172
+ import { useServer } from '@innet/sever'
4173
+
4174
+ export function Component () {
4175
+ const server = useServer()
4176
+
4177
+ console.log(server)
4178
+
4179
+ return <success />
4180
+ }
4181
+ ```
4182
+
4183
+ ### useComponentName
4184
+
4185
+ [← back](#hooks)
4186
+
4187
+ This hook returns name of current component.
4188
+
4189
+ *src/Component.tsx*
4190
+ ```typescript jsx
4191
+ import { useComponentName } from '@innet/sever'
4192
+
4193
+ export function Component () {
4194
+ // returns this ^-------^
4195
+ const name = useComponentName()
4196
+
4197
+ return <success>{{ name }}</success>
4198
+ }
4199
+ ```
4200
+
3499
4201
  ## Issues
3500
4202
  If you find a bug or have a suggestion, please file an issue on [GitHub](https://github.com/d8corp/innet-server/issues).
3501
4203