@innet/server 2.0.0-alpha.33 → 2.0.0-alpha.35
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
CHANGED
|
@@ -159,7 +159,7 @@ export default (
|
|
|
159
159
|
)
|
|
160
160
|
```
|
|
161
161
|
|
|
162
|
-
- By default, it uses port `80` for `http` and port `
|
|
162
|
+
- By default, it uses port `80` for `http` and port `443` for `https`.
|
|
163
163
|
- You can use `INNET_PORT` environment variable to set it up on CI level.
|
|
164
164
|
- [innetjs](https://www.npmjs.com/package/innetjs) allows you to use `INNET_PORT` in `.env` file of local environment.
|
|
165
165
|
|
|
@@ -3304,9 +3304,9 @@ This is a base element to return a success data.
|
|
|
3304
3304
|
```typescript jsx
|
|
3305
3305
|
export default (
|
|
3306
3306
|
<server>
|
|
3307
|
-
<
|
|
3307
|
+
<return>
|
|
3308
3308
|
<success />
|
|
3309
|
-
</
|
|
3309
|
+
</return>
|
|
3310
3310
|
</server>
|
|
3311
3311
|
)
|
|
3312
3312
|
```
|
|
@@ -3321,11 +3321,11 @@ const data = {...}
|
|
|
3321
3321
|
|
|
3322
3322
|
export default (
|
|
3323
3323
|
<server>
|
|
3324
|
-
<
|
|
3324
|
+
<return>
|
|
3325
3325
|
<success>
|
|
3326
3326
|
{data}
|
|
3327
3327
|
</success>
|
|
3328
|
-
</
|
|
3328
|
+
</return>
|
|
3329
3329
|
</server>
|
|
3330
3330
|
)
|
|
3331
3331
|
```
|
|
@@ -3342,11 +3342,11 @@ const data = {...}
|
|
|
3342
3342
|
|
|
3343
3343
|
export default (
|
|
3344
3344
|
<server>
|
|
3345
|
-
<
|
|
3345
|
+
<return>
|
|
3346
3346
|
<success status='created'>
|
|
3347
3347
|
{data}
|
|
3348
3348
|
</success>
|
|
3349
|
-
</
|
|
3349
|
+
</return>
|
|
3350
3350
|
</server>
|
|
3351
3351
|
)
|
|
3352
3352
|
```
|
|
@@ -3361,11 +3361,11 @@ const data = {...}
|
|
|
3361
3361
|
|
|
3362
3362
|
export default (
|
|
3363
3363
|
<server>
|
|
3364
|
-
<
|
|
3364
|
+
<return>
|
|
3365
3365
|
<success status={201}>
|
|
3366
3366
|
{data}
|
|
3367
3367
|
</success>
|
|
3368
|
-
</
|
|
3368
|
+
</return>
|
|
3369
3369
|
</server>
|
|
3370
3370
|
)
|
|
3371
3371
|
```
|
|
@@ -3379,11 +3379,11 @@ By default, it checks children element to define the prop.
|
|
|
3379
3379
|
```typescript jsx
|
|
3380
3380
|
export default (
|
|
3381
3381
|
<server>
|
|
3382
|
-
<
|
|
3382
|
+
<return>
|
|
3383
3383
|
<success contentType='text/html'>
|
|
3384
3384
|
Hello World!
|
|
3385
3385
|
</success>
|
|
3386
|
-
</
|
|
3386
|
+
</return>
|
|
3387
3387
|
</server>
|
|
3388
3388
|
)
|
|
3389
3389
|
```
|
|
@@ -3393,15 +3393,15 @@ export default (
|
|
|
3393
3393
|
[← back](#run-time)
|
|
3394
3394
|
|
|
3395
3395
|
Returns an error.
|
|
3396
|
-
This element MUST be placed in [\<return>](#return)
|
|
3396
|
+
This element MUST be placed in [\<return>](#return).
|
|
3397
3397
|
|
|
3398
3398
|
*src/app.tsx*
|
|
3399
3399
|
```typescript jsx
|
|
3400
3400
|
export default (
|
|
3401
3401
|
<server>
|
|
3402
|
-
<
|
|
3402
|
+
<return>
|
|
3403
3403
|
<error />
|
|
3404
|
-
</
|
|
3404
|
+
</return>
|
|
3405
3405
|
</server>
|
|
3406
3406
|
)
|
|
3407
3407
|
```
|
|
@@ -3414,11 +3414,11 @@ const data = {...}
|
|
|
3414
3414
|
|
|
3415
3415
|
export default (
|
|
3416
3416
|
<server>
|
|
3417
|
-
<
|
|
3417
|
+
<return>
|
|
3418
3418
|
<error>
|
|
3419
3419
|
{data}
|
|
3420
3420
|
</error>
|
|
3421
|
-
</
|
|
3421
|
+
</return>
|
|
3422
3422
|
</server>
|
|
3423
3423
|
)
|
|
3424
3424
|
```
|
|
@@ -3434,11 +3434,11 @@ const data = {
|
|
|
3434
3434
|
|
|
3435
3435
|
export default (
|
|
3436
3436
|
<server>
|
|
3437
|
-
<
|
|
3437
|
+
<return>
|
|
3438
3438
|
<error status='notFound'>
|
|
3439
3439
|
{data}
|
|
3440
3440
|
</error>
|
|
3441
|
-
</
|
|
3441
|
+
</return>
|
|
3442
3442
|
</server>
|
|
3443
3443
|
)
|
|
3444
3444
|
```
|
|
@@ -3453,11 +3453,11 @@ const data = {
|
|
|
3453
3453
|
|
|
3454
3454
|
export default (
|
|
3455
3455
|
<server>
|
|
3456
|
-
<
|
|
3456
|
+
<return>
|
|
3457
3457
|
<error status={404}>
|
|
3458
3458
|
{data}
|
|
3459
3459
|
</error>
|
|
3460
|
-
</
|
|
3460
|
+
</return>
|
|
3461
3461
|
</server>
|
|
3462
3462
|
)
|
|
3463
3463
|
```
|
|
@@ -3485,13 +3485,13 @@ const data = {
|
|
|
3485
3485
|
|
|
3486
3486
|
export default (
|
|
3487
3487
|
<server>
|
|
3488
|
-
<
|
|
3488
|
+
<return>
|
|
3489
3489
|
<error
|
|
3490
3490
|
code='noUser'
|
|
3491
3491
|
status='notFound'>
|
|
3492
3492
|
{data}
|
|
3493
3493
|
</error>
|
|
3494
|
-
</
|
|
3494
|
+
</return>
|
|
3495
3495
|
</server>
|
|
3496
3496
|
)
|
|
3497
3497
|
```
|
|
@@ -3519,7 +3519,7 @@ There are some default errors:
|
|
|
3519
3519
|
|
|
3520
3520
|
[← back](#run-time)
|
|
3521
3521
|
|
|
3522
|
-
MUST be placed in [\<return>](#return)
|
|
3522
|
+
MUST be placed in [\<return>](#return).
|
|
3523
3523
|
|
|
3524
3524
|
You can easy proxy endpoints to another server/service.
|
|
3525
3525
|
|
|
@@ -3536,9 +3536,9 @@ export default (
|
|
|
3536
3536
|
</return>
|
|
3537
3537
|
</endpoint>
|
|
3538
3538
|
</api>
|
|
3539
|
-
<
|
|
3539
|
+
<return>
|
|
3540
3540
|
<proxy to='https://...' />
|
|
3541
|
-
</
|
|
3541
|
+
</return>
|
|
3542
3542
|
</server>
|
|
3543
3543
|
)
|
|
3544
3544
|
```
|
|
@@ -3547,7 +3547,7 @@ export default (
|
|
|
3547
3547
|
|
|
3548
3548
|
[← back](#run-time)
|
|
3549
3549
|
|
|
3550
|
-
MUST be placed in [\<return>](#return)
|
|
3550
|
+
MUST be placed in [\<return>](#return).
|
|
3551
3551
|
|
|
3552
3552
|
You can redirect users to another resource. It adds `Cache-Control` header by default.
|
|
3553
3553
|
|
|
@@ -3592,12 +3592,12 @@ export default (
|
|
|
3592
3592
|
</return>
|
|
3593
3593
|
</endpoint>
|
|
3594
3594
|
</api>
|
|
3595
|
-
<
|
|
3595
|
+
<return>
|
|
3596
3596
|
<redirect
|
|
3597
3597
|
status={303}
|
|
3598
3598
|
to='https://...'
|
|
3599
3599
|
/>
|
|
3600
|
-
</
|
|
3600
|
+
</return>
|
|
3601
3601
|
</server>
|
|
3602
3602
|
)
|
|
3603
3603
|
```
|
|
@@ -3606,7 +3606,7 @@ export default (
|
|
|
3606
3606
|
|
|
3607
3607
|
[← back](#run-time)
|
|
3608
3608
|
|
|
3609
|
-
MUST be placed in [\<return>](#return)
|
|
3609
|
+
MUST be placed in [\<return>](#return).
|
|
3610
3610
|
|
|
3611
3611
|
`<cms>` helps to return files from a folder by path. It checks files run-time on the server.
|
|
3612
3612
|
|
|
@@ -3614,9 +3614,9 @@ MUST be placed in [\<return>](#return) or [\<response>](#response).
|
|
|
3614
3614
|
```typescript jsx
|
|
3615
3615
|
export default (
|
|
3616
3616
|
<server>
|
|
3617
|
-
<
|
|
3617
|
+
<return>
|
|
3618
3618
|
<cms />
|
|
3619
|
-
</
|
|
3619
|
+
</return>
|
|
3620
3620
|
</server>
|
|
3621
3621
|
)
|
|
3622
3622
|
```
|
|
@@ -3633,9 +3633,9 @@ You can change root folder by `dir` property.
|
|
|
3633
3633
|
```typescript jsx
|
|
3634
3634
|
export default (
|
|
3635
3635
|
<server>
|
|
3636
|
-
<
|
|
3636
|
+
<return>
|
|
3637
3637
|
<cms dir='src' />
|
|
3638
|
-
</
|
|
3638
|
+
</return>
|
|
3639
3639
|
</server>
|
|
3640
3640
|
)
|
|
3641
3641
|
```
|
|
@@ -3653,9 +3653,9 @@ By default, it equals `INNET_CMS_PREFIX` node env variable or `/`.
|
|
|
3653
3653
|
export default (
|
|
3654
3654
|
<server>
|
|
3655
3655
|
<api prefix='/src'>
|
|
3656
|
-
<
|
|
3656
|
+
<return>
|
|
3657
3657
|
<cms />
|
|
3658
|
-
</
|
|
3658
|
+
</return>
|
|
3659
3659
|
</api>
|
|
3660
3660
|
</server>
|
|
3661
3661
|
)
|
|
@@ -3671,9 +3671,9 @@ You can reduce the path for matching by prefix property of `<cms>`.
|
|
|
3671
3671
|
export default (
|
|
3672
3672
|
<server>
|
|
3673
3673
|
<api prefix='/api'>
|
|
3674
|
-
<
|
|
3674
|
+
<return>
|
|
3675
3675
|
<cms prefix='/api' />
|
|
3676
|
-
</
|
|
3676
|
+
</return>
|
|
3677
3677
|
</api>
|
|
3678
3678
|
</server>
|
|
3679
3679
|
)
|
|
@@ -3689,11 +3689,11 @@ You can handle if a file was not found by children elements of `<cms>`.
|
|
|
3689
3689
|
```typescript jsx
|
|
3690
3690
|
export default (
|
|
3691
3691
|
<server>
|
|
3692
|
-
<
|
|
3692
|
+
<return>
|
|
3693
3693
|
<cms>
|
|
3694
3694
|
<error status={404} />
|
|
3695
3695
|
</cms>
|
|
3696
|
-
</
|
|
3696
|
+
</return>
|
|
3697
3697
|
</server>
|
|
3698
3698
|
)
|
|
3699
3699
|
```
|
|
@@ -3702,7 +3702,7 @@ export default (
|
|
|
3702
3702
|
|
|
3703
3703
|
[← back](#run-time)
|
|
3704
3704
|
|
|
3705
|
-
It returns a file. MUST be placed in [\<return>](#return)
|
|
3705
|
+
It returns a file. MUST be placed in [\<return>](#return).
|
|
3706
3706
|
|
|
3707
3707
|
It adds `Content-Length` and `Content-Type` automatically.
|
|
3708
3708
|
|
|
@@ -3712,9 +3712,9 @@ It has a REQUIRED property of `path`.
|
|
|
3712
3712
|
```typescript jsx
|
|
3713
3713
|
export default (
|
|
3714
3714
|
<server>
|
|
3715
|
-
<
|
|
3715
|
+
<return>
|
|
3716
3716
|
<file path='package.json' />
|
|
3717
|
-
</
|
|
3717
|
+
</return>
|
|
3718
3718
|
</server>
|
|
3719
3719
|
)
|
|
3720
3720
|
```
|
|
@@ -3729,18 +3729,18 @@ You can handle if a file was not found by children elements of `<file>`.
|
|
|
3729
3729
|
```typescript jsx
|
|
3730
3730
|
export default (
|
|
3731
3731
|
<server>
|
|
3732
|
-
<
|
|
3732
|
+
<return>
|
|
3733
3733
|
<file path='file_is_not_exist.txt'>
|
|
3734
3734
|
<error status={404} />
|
|
3735
3735
|
</file>
|
|
3736
|
-
</
|
|
3736
|
+
</return>
|
|
3737
3737
|
</server>
|
|
3738
3738
|
)
|
|
3739
3739
|
```
|
|
3740
3740
|
|
|
3741
3741
|
### \<header>
|
|
3742
3742
|
|
|
3743
|
-
MUST be placed in [\<return>](#return)
|
|
3743
|
+
MUST be placed in [\<return>](#return).
|
|
3744
3744
|
|
|
3745
3745
|
[← back](#run-time)
|
|
3746
3746
|
|
|
@@ -3750,20 +3750,20 @@ You can add an HTTP header into response by `<header>` element.
|
|
|
3750
3750
|
```typescript jsx
|
|
3751
3751
|
export default (
|
|
3752
3752
|
<server>
|
|
3753
|
-
<
|
|
3753
|
+
<return>
|
|
3754
3754
|
<header
|
|
3755
3755
|
key='Cache-Control'
|
|
3756
3756
|
value='no-cache, no-store, must-revalidate'
|
|
3757
3757
|
/>
|
|
3758
3758
|
<success />
|
|
3759
|
-
</
|
|
3759
|
+
</return>
|
|
3760
3760
|
</server>
|
|
3761
3761
|
)
|
|
3762
3762
|
```
|
|
3763
3763
|
|
|
3764
3764
|
### \<cookie>
|
|
3765
3765
|
|
|
3766
|
-
MUST be placed in [\<return>](#return)
|
|
3766
|
+
MUST be placed in [\<return>](#return).
|
|
3767
3767
|
|
|
3768
3768
|
[← back](#run-time)
|
|
3769
3769
|
|
|
@@ -3773,7 +3773,7 @@ You can add/remove a cookie into response by `<cookie>` element.
|
|
|
3773
3773
|
```typescript jsx
|
|
3774
3774
|
export default (
|
|
3775
3775
|
<server>
|
|
3776
|
-
<
|
|
3776
|
+
<return>
|
|
3777
3777
|
<cookie
|
|
3778
3778
|
key='token'
|
|
3779
3779
|
value='...'
|
|
@@ -3782,7 +3782,7 @@ export default (
|
|
|
3782
3782
|
key='removedCookie'
|
|
3783
3783
|
/>
|
|
3784
3784
|
<success />
|
|
3785
|
-
</
|
|
3785
|
+
</return>
|
|
3786
3786
|
</server>
|
|
3787
3787
|
)
|
|
3788
3788
|
```
|
|
@@ -3796,14 +3796,14 @@ By default, no domain is set, and most clients will consider the cookie to apply
|
|
|
3796
3796
|
```typescript jsx
|
|
3797
3797
|
export default (
|
|
3798
3798
|
<server>
|
|
3799
|
-
<
|
|
3799
|
+
<return>
|
|
3800
3800
|
<cookie
|
|
3801
3801
|
domain='.example.com'
|
|
3802
3802
|
key='token'
|
|
3803
3803
|
value='...'
|
|
3804
3804
|
/>
|
|
3805
3805
|
<success />
|
|
3806
|
-
</
|
|
3806
|
+
</return>
|
|
3807
3807
|
</server>
|
|
3808
3808
|
)
|
|
3809
3809
|
```
|
|
@@ -3822,14 +3822,14 @@ Note the [cookie storage model specification](https://datatracker.ietf.org/doc/h
|
|
|
3822
3822
|
```typescript jsx
|
|
3823
3823
|
export default (
|
|
3824
3824
|
<server>
|
|
3825
|
-
<
|
|
3825
|
+
<return>
|
|
3826
3826
|
<cookie
|
|
3827
3827
|
expires={new Date('2050-01-01')}
|
|
3828
3828
|
key='token'
|
|
3829
3829
|
value='...'
|
|
3830
3830
|
/>
|
|
3831
3831
|
<success />
|
|
3832
|
-
</
|
|
3832
|
+
</return>
|
|
3833
3833
|
</server>
|
|
3834
3834
|
)
|
|
3835
3835
|
```
|
|
@@ -3843,14 +3843,14 @@ Note be careful when setting this to true, as compliant clients will not allow c
|
|
|
3843
3843
|
```typescript jsx
|
|
3844
3844
|
export default (
|
|
3845
3845
|
<server>
|
|
3846
|
-
<
|
|
3846
|
+
<return>
|
|
3847
3847
|
<cookie
|
|
3848
3848
|
httpOnly
|
|
3849
3849
|
key='token'
|
|
3850
3850
|
value='...'
|
|
3851
3851
|
/>
|
|
3852
3852
|
<success />
|
|
3853
|
-
</
|
|
3853
|
+
</return>
|
|
3854
3854
|
</server>
|
|
3855
3855
|
)
|
|
3856
3856
|
```
|
|
@@ -3864,7 +3864,7 @@ Note the [cookie storage model specification](https://datatracker.ietf.org/doc/h
|
|
|
3864
3864
|
```typescript jsx
|
|
3865
3865
|
export default (
|
|
3866
3866
|
<server>
|
|
3867
|
-
<
|
|
3867
|
+
<return>
|
|
3868
3868
|
<cookie
|
|
3869
3869
|
httpOnly
|
|
3870
3870
|
maxAge={9999}
|
|
@@ -3872,7 +3872,7 @@ export default (
|
|
|
3872
3872
|
value='...'
|
|
3873
3873
|
/>
|
|
3874
3874
|
<success />
|
|
3875
|
-
</
|
|
3875
|
+
</return>
|
|
3876
3876
|
</server>
|
|
3877
3877
|
)
|
|
3878
3878
|
```
|
|
@@ -3886,7 +3886,7 @@ By default, the path is considered the “default path”.
|
|
|
3886
3886
|
```typescript jsx
|
|
3887
3887
|
export default (
|
|
3888
3888
|
<server>
|
|
3889
|
-
<
|
|
3889
|
+
<return>
|
|
3890
3890
|
<cookie
|
|
3891
3891
|
httpOnly
|
|
3892
3892
|
maxAge={9999}
|
|
@@ -3895,7 +3895,7 @@ export default (
|
|
|
3895
3895
|
value='...'
|
|
3896
3896
|
/>
|
|
3897
3897
|
<success />
|
|
3898
|
-
</
|
|
3898
|
+
</return>
|
|
3899
3899
|
</server>
|
|
3900
3900
|
)
|
|
3901
3901
|
```
|
|
@@ -3914,7 +3914,7 @@ note This is an attribute that has not yet been fully standardized, and may chan
|
|
|
3914
3914
|
```typescript jsx
|
|
3915
3915
|
export default (
|
|
3916
3916
|
<server>
|
|
3917
|
-
<
|
|
3917
|
+
<return>
|
|
3918
3918
|
<cookie
|
|
3919
3919
|
httpOnly
|
|
3920
3920
|
priority='high'
|
|
@@ -3923,7 +3923,7 @@ export default (
|
|
|
3923
3923
|
value='...'
|
|
3924
3924
|
/>
|
|
3925
3925
|
<success />
|
|
3926
|
-
</
|
|
3926
|
+
</return>
|
|
3927
3927
|
</server>
|
|
3928
3928
|
)
|
|
3929
3929
|
```
|
|
@@ -3945,7 +3945,7 @@ This also means many clients may ignore this attribute until they understand it.
|
|
|
3945
3945
|
```typescript jsx
|
|
3946
3946
|
export default (
|
|
3947
3947
|
<server>
|
|
3948
|
-
<
|
|
3948
|
+
<return>
|
|
3949
3949
|
<cookie
|
|
3950
3950
|
httpOnly
|
|
3951
3951
|
sameSite
|
|
@@ -3955,7 +3955,7 @@ export default (
|
|
|
3955
3955
|
value='...'
|
|
3956
3956
|
/>
|
|
3957
3957
|
<success />
|
|
3958
|
-
</
|
|
3958
|
+
</return>
|
|
3959
3959
|
</server>
|
|
3960
3960
|
)
|
|
3961
3961
|
```
|
|
@@ -3972,7 +3972,7 @@ Note be careful when setting this to true, as compliant clients will not send th
|
|
|
3972
3972
|
```typescript jsx
|
|
3973
3973
|
export default (
|
|
3974
3974
|
<server>
|
|
3975
|
-
<
|
|
3975
|
+
<return>
|
|
3976
3976
|
<cookie
|
|
3977
3977
|
httpOnly
|
|
3978
3978
|
secure
|
|
@@ -3980,7 +3980,7 @@ export default (
|
|
|
3980
3980
|
value='...'
|
|
3981
3981
|
/>
|
|
3982
3982
|
<success />
|
|
3983
|
-
</
|
|
3983
|
+
</return>
|
|
3984
3984
|
</server>
|
|
3985
3985
|
)
|
|
3986
3986
|
```
|
|
@@ -4013,12 +4013,12 @@ import { SetToken } from './SetToken'
|
|
|
4013
4013
|
|
|
4014
4014
|
export default (
|
|
4015
4015
|
<server>
|
|
4016
|
-
<
|
|
4016
|
+
<return>
|
|
4017
4017
|
<SetToken
|
|
4018
4018
|
value='...'
|
|
4019
4019
|
/>
|
|
4020
4020
|
<success />
|
|
4021
|
-
</
|
|
4021
|
+
</return>
|
|
4022
4022
|
</server>
|
|
4023
4023
|
)
|
|
4024
4024
|
```
|
|
@@ -4057,7 +4057,7 @@ Both
|
|
|
4057
4057
|
|
|
4058
4058
|
[← back](#hooks)
|
|
4059
4059
|
|
|
4060
|
-
This hook MUST be used in a component placed in [\<return>](#return)
|
|
4060
|
+
This hook MUST be used in a component placed in [\<return>](#return).
|
|
4061
4061
|
This hook returns current request instance.
|
|
4062
4062
|
|
|
4063
4063
|
*src/Component.tsx*
|
|
@@ -4078,7 +4078,7 @@ export function Component () {
|
|
|
4078
4078
|
|
|
4079
4079
|
[← back](#hooks)
|
|
4080
4080
|
|
|
4081
|
-
This hook MUST be used in a component placed in [\<return>](#return)
|
|
4081
|
+
This hook MUST be used in a component placed in [\<return>](#return).
|
|
4082
4082
|
This hook returns current response instance.
|
|
4083
4083
|
|
|
4084
4084
|
*src/Component.tsx*
|
|
@@ -4099,7 +4099,7 @@ export function Component () {
|
|
|
4099
4099
|
|
|
4100
4100
|
[← back](#hooks)
|
|
4101
4101
|
|
|
4102
|
-
This hook MUST be used in a component placed in [\<return>](#return)
|
|
4102
|
+
This hook MUST be used in a component placed in [\<return>](#return).
|
|
4103
4103
|
This hook returns current request headers object.
|
|
4104
4104
|
|
|
4105
4105
|
*src/Component.tsx*
|
|
@@ -4118,7 +4118,7 @@ export function Component () {
|
|
|
4118
4118
|
|
|
4119
4119
|
[← back](#hooks)
|
|
4120
4120
|
|
|
4121
|
-
This hook MUST be used in a component placed in [\<return>](#return)
|
|
4121
|
+
This hook MUST be used in a component placed in [\<return>](#return).
|
|
4122
4122
|
This hook returns current request cookies object.
|
|
4123
4123
|
|
|
4124
4124
|
*src/Component.tsx*
|
|
@@ -4137,7 +4137,7 @@ export function Component () {
|
|
|
4137
4137
|
|
|
4138
4138
|
[← back](#hooks)
|
|
4139
4139
|
|
|
4140
|
-
This hook MUST be used in a component placed in [\<return>](#return)
|
|
4140
|
+
This hook MUST be used in a component placed in [\<return>](#return).
|
|
4141
4141
|
This hook returns current request URL path as a `string`.
|
|
4142
4142
|
|
|
4143
4143
|
*src/Component.tsx*
|
|
@@ -4156,7 +4156,7 @@ export function Component () {
|
|
|
4156
4156
|
|
|
4157
4157
|
[← back](#hooks)
|
|
4158
4158
|
|
|
4159
|
-
This hook MUST be used in a component placed in [\<return>](#return)
|
|
4159
|
+
This hook MUST be used in a component placed in [\<return>](#return).
|
|
4160
4160
|
This hook returns an object of URL params you set by [\<param>](#param).
|
|
4161
4161
|
|
|
4162
4162
|
*src/Component.tsx*
|
|
@@ -4174,7 +4174,7 @@ export function Component () {
|
|
|
4174
4174
|
|
|
4175
4175
|
[← back](#hooks)
|
|
4176
4176
|
|
|
4177
|
-
This hook MUST be used in a component placed in [\<return>](#return)
|
|
4177
|
+
This hook MUST be used in a component placed in [\<return>](#return).
|
|
4178
4178
|
This hook returns an object of URL query params.
|
|
4179
4179
|
|
|
4180
4180
|
*src/Component.tsx*
|
|
@@ -4192,7 +4192,7 @@ export function Component () {
|
|
|
4192
4192
|
|
|
4193
4193
|
[← back](#hooks)
|
|
4194
4194
|
|
|
4195
|
-
This hook MUST be used in a component placed in [\<return>](#return)
|
|
4195
|
+
This hook MUST be used in a component placed in [\<return>](#return).
|
|
4196
4196
|
This hook returns current request body.
|
|
4197
4197
|
|
|
4198
4198
|
*src/Component.tsx*
|
|
@@ -4211,7 +4211,7 @@ export function Component () {
|
|
|
4211
4211
|
[← back](#hooks)
|
|
4212
4212
|
|
|
4213
4213
|
This hook returns request user IP.
|
|
4214
|
-
This hook MUST be used in a component placed in [\<return>](#return)
|
|
4214
|
+
This hook MUST be used in a component placed in [\<return>](#return).
|
|
4215
4215
|
|
|
4216
4216
|
*src/Component.tsx*
|
|
4217
4217
|
```typescript jsx
|
|
@@ -4258,9 +4258,9 @@ import { SecretEndpoint } from './SecretEndpoint'
|
|
|
4258
4258
|
export default (
|
|
4259
4259
|
<server>
|
|
4260
4260
|
<SecretEndpoint />
|
|
4261
|
-
<
|
|
4261
|
+
<return>
|
|
4262
4262
|
<error />
|
|
4263
|
-
</
|
|
4263
|
+
</return>
|
|
4264
4264
|
</server>
|
|
4265
4265
|
)
|
|
4266
4266
|
```
|
package/package.json
CHANGED
|
@@ -33,7 +33,7 @@ const server = () => {
|
|
|
33
33
|
cert = '';
|
|
34
34
|
}
|
|
35
35
|
const https = Boolean(key && cert);
|
|
36
|
-
const { onClose, onError, onRequest, onStart, port = Number((_c = env.INNET_PORT) !== null && _c !== void 0 ? _c : (https ?
|
|
36
|
+
const { onClose, onError, onRequest, onStart, port = Number((_c = env.INNET_PORT) !== null && _c !== void 0 ? _c : (https ? 443 : 80)), } = props;
|
|
37
37
|
const plugins = new Set();
|
|
38
38
|
const server = https ? http2.createServer({ cert, key }) : http.createServer();
|
|
39
39
|
serverContext.set(handler, { port, server });
|
|
@@ -44,7 +44,7 @@ const server = () => {
|
|
|
44
44
|
cert = '';
|
|
45
45
|
}
|
|
46
46
|
const https = Boolean(key && cert);
|
|
47
|
-
const { onClose, onError, onRequest, onStart, port = Number((_c = env.INNET_PORT) !== null && _c !== void 0 ? _c : (https ?
|
|
47
|
+
const { onClose, onError, onRequest, onStart, port = Number((_c = env.INNET_PORT) !== null && _c !== void 0 ? _c : (https ? 443 : 80)), } = props;
|
|
48
48
|
const plugins = new Set();
|
|
49
49
|
const server = https ? http2__default["default"].createServer({ cert, key }) : http__default["default"].createServer();
|
|
50
50
|
useServer.serverContext.set(handler, { port, server });
|
|
@@ -43,7 +43,7 @@ const string = () => {
|
|
|
43
43
|
if (props.ref) {
|
|
44
44
|
refRules[props.ref] = rule;
|
|
45
45
|
}
|
|
46
|
-
if (props.default) {
|
|
46
|
+
if (props.default !== undefined) {
|
|
47
47
|
useRule(rule);
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
@@ -52,7 +52,7 @@ const string = () => {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
else if (props.ref) {
|
|
55
|
-
if (props.default) {
|
|
55
|
+
if (props.default !== undefined) {
|
|
56
56
|
useRule(refRules[props.ref]);
|
|
57
57
|
}
|
|
58
58
|
else {
|
|
@@ -47,7 +47,7 @@ const string = () => {
|
|
|
47
47
|
if (props.ref) {
|
|
48
48
|
refRules[props.ref] = rule;
|
|
49
49
|
}
|
|
50
|
-
if (props.default) {
|
|
50
|
+
if (props.default !== undefined) {
|
|
51
51
|
useRule.useRule(rule);
|
|
52
52
|
}
|
|
53
53
|
else {
|
|
@@ -56,7 +56,7 @@ const string = () => {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
else if (props.ref) {
|
|
59
|
-
if (props.default) {
|
|
59
|
+
if (props.default !== undefined) {
|
|
60
60
|
useRule.useRule(refRules[props.ref]);
|
|
61
61
|
}
|
|
62
62
|
else {
|