@je-es/server 0.1.0 → 0.1.1
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 +78 -26
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,41 +3,55 @@
|
|
|
3
3
|
<br>
|
|
4
4
|
<div align="center">
|
|
5
5
|
<p>
|
|
6
|
-
<img src="./assets/img/logo.png" alt="logo" style="" height="
|
|
6
|
+
<img src="./assets/img/logo.png" alt="logo" style="" height="80" />
|
|
7
7
|
</p>
|
|
8
8
|
</div>
|
|
9
9
|
|
|
10
10
|
<div align="center">
|
|
11
|
-
<img src="https://img.shields.io/badge/v-
|
|
11
|
+
<img src="https://img.shields.io/badge/v-1.1.0-black"/>
|
|
12
12
|
<a href="https://github.com/maysara-elshewehy">
|
|
13
13
|
</a>
|
|
14
|
-
<a href="https://github.com/je-es
|
|
15
|
-
</div>
|
|
16
|
-
|
|
17
|
-
<div align="center">
|
|
18
|
-
<img src="./assets/img/line.png" alt="line" style="display: block; margin-top:20px;margin-bottom:20px;width:500px;"/>
|
|
19
|
-
<br>
|
|
14
|
+
<a href="https://github.com/je-es"> <img src="https://img.shields.io/badge/@-je--es-black"/> </a>
|
|
20
15
|
</div>
|
|
16
|
+
<br>
|
|
21
17
|
|
|
22
18
|
<!-- ╚═════════════════════════════════════════════════════════════════╝ -->
|
|
23
19
|
|
|
24
20
|
|
|
25
21
|
|
|
22
|
+
|
|
26
23
|
<!-- ╔══════════════════════════════ DOC ══════════════════════════════╗ -->
|
|
27
24
|
|
|
25
|
+
|
|
28
26
|
- ## Quick Start 🔥
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
> _**The simplest, fastest, most organized and stable way to build servers.**_
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
# install
|
|
34
|
-
space i @je-es/server
|
|
30
|
+
> _We prefer to use [`space`](https://github.com//solution-lib/space) with [`@solution-dist/server`](https://github.com/solution-dist/server) for a better experience._
|
|
35
31
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
```bash
|
|
33
|
+
space init <server-name> -t server
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
cd <server-name>
|
|
38
|
+
space install
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# example
|
|
43
|
+
> space start
|
|
44
|
+
|
|
45
|
+
# output
|
|
46
|
+
16:16:31 ✓ Server started at http://localhost:3000
|
|
47
|
+
16:17:25 GET / 200 4ms
|
|
48
|
+
...
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
<br>
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
- ## Examples
|
|
41
55
|
|
|
42
56
|
- ### Basic Server
|
|
43
57
|
|
|
@@ -92,6 +106,8 @@
|
|
|
92
106
|
...
|
|
93
107
|
```
|
|
94
108
|
|
|
109
|
+
<div align="center"> <img src="./assets/img/line.png" alt="line" style="display: block; margin-top:20px;margin-bottom:20px;width:500px;"/> <br> </div>
|
|
110
|
+
|
|
95
111
|
- ### With Database
|
|
96
112
|
|
|
97
113
|
```typescript
|
|
@@ -134,6 +150,8 @@
|
|
|
134
150
|
// Data persists in ./my_app.db file!
|
|
135
151
|
```
|
|
136
152
|
|
|
153
|
+
<div align="center"> <img src="./assets/img/line.png" alt="line" style="display: block; margin-top:20px;margin-bottom:20px;width:500px;"/> <br> </div>
|
|
154
|
+
|
|
137
155
|
- ### With Security
|
|
138
156
|
|
|
139
157
|
```typescript
|
|
@@ -168,7 +186,7 @@
|
|
|
168
186
|
await app.start();
|
|
169
187
|
```
|
|
170
188
|
|
|
171
|
-
<
|
|
189
|
+
<br>
|
|
172
190
|
|
|
173
191
|
- ## API Reference
|
|
174
192
|
|
|
@@ -219,6 +237,8 @@
|
|
|
219
237
|
await app.start();
|
|
220
238
|
```
|
|
221
239
|
|
|
240
|
+
<div align="center"> <img src="./assets/img/line.png" alt="line" style="display: block; margin-top:20px;margin-bottom:20px;width:500px;"/> <br> </div>
|
|
241
|
+
|
|
222
242
|
- ### Route Definition
|
|
223
243
|
|
|
224
244
|
```typescript
|
|
@@ -258,6 +278,8 @@
|
|
|
258
278
|
};
|
|
259
279
|
```
|
|
260
280
|
|
|
281
|
+
<div align="center"> <img src="./assets/img/line.png" alt="line" style="display: block; margin-top:20px;margin-bottom:20px;width:500px;"/> <br> </div>
|
|
282
|
+
|
|
261
283
|
- ### Context API
|
|
262
284
|
|
|
263
285
|
```typescript
|
|
@@ -315,7 +337,7 @@
|
|
|
315
337
|
}
|
|
316
338
|
```
|
|
317
339
|
|
|
318
|
-
<
|
|
340
|
+
<br>
|
|
319
341
|
|
|
320
342
|
- ## Security Features
|
|
321
343
|
|
|
@@ -337,6 +359,8 @@
|
|
|
337
359
|
});
|
|
338
360
|
```
|
|
339
361
|
|
|
362
|
+
<div align="center"> <img src="./assets/img/line.png" alt="line" style="display: block; margin-top:20px;margin-bottom:20px;width:500px;"/> <br> </div>
|
|
363
|
+
|
|
340
364
|
- ### CORS Configuration
|
|
341
365
|
|
|
342
366
|
```typescript
|
|
@@ -363,6 +387,8 @@
|
|
|
363
387
|
});
|
|
364
388
|
```
|
|
365
389
|
|
|
390
|
+
<div align="center"> <img src="./assets/img/line.png" alt="line" style="display: block; margin-top:20px;margin-bottom:20px;width:500px;"/> <br> </div>
|
|
391
|
+
|
|
366
392
|
- ### CSRF Protection
|
|
367
393
|
|
|
368
394
|
```typescript
|
|
@@ -377,6 +403,8 @@
|
|
|
377
403
|
const isValid = security.validateCsrfToken(token, 'session-id');
|
|
378
404
|
```
|
|
379
405
|
|
|
406
|
+
<div align="center"> <img src="./assets/img/line.png" alt="line" style="display: block; margin-top:20px;margin-bottom:20px;width:500px;"/> <br> </div>
|
|
407
|
+
|
|
380
408
|
- ### Input Sanitization
|
|
381
409
|
|
|
382
410
|
```typescript
|
|
@@ -393,7 +421,7 @@
|
|
|
393
421
|
// Output: ''; DROP TABLE users--
|
|
394
422
|
```
|
|
395
423
|
|
|
396
|
-
<
|
|
424
|
+
<br>
|
|
397
425
|
|
|
398
426
|
- ## Database Support
|
|
399
427
|
|
|
@@ -412,6 +440,8 @@
|
|
|
412
440
|
// Access in routes via c.db
|
|
413
441
|
```
|
|
414
442
|
|
|
443
|
+
<div align="center"> <img src="./assets/img/line.png" alt="line" style="display: block; margin-top:20px;margin-bottom:20px;width:500px;"/> <br> </div>
|
|
444
|
+
|
|
415
445
|
- ### Multiple Databases
|
|
416
446
|
|
|
417
447
|
```typescript
|
|
@@ -450,6 +480,8 @@
|
|
|
450
480
|
});
|
|
451
481
|
```
|
|
452
482
|
|
|
483
|
+
<div align="center"> <img src="./assets/img/line.png" alt="line" style="display: block; margin-top:20px;margin-bottom:20px;width:500px;"/> <br> </div>
|
|
484
|
+
|
|
453
485
|
- ### Schema Definition
|
|
454
486
|
|
|
455
487
|
```typescript
|
|
@@ -494,6 +526,8 @@
|
|
|
494
526
|
});
|
|
495
527
|
```
|
|
496
528
|
|
|
529
|
+
<div align="center"> <img src="./assets/img/line.png" alt="line" style="display: block; margin-top:20px;margin-bottom:20px;width:500px;"/> <br> </div>
|
|
530
|
+
|
|
497
531
|
- ### Database Operations
|
|
498
532
|
|
|
499
533
|
```typescript
|
|
@@ -583,6 +617,8 @@
|
|
|
583
617
|
});
|
|
584
618
|
```
|
|
585
619
|
|
|
620
|
+
<div align="center"> <img src="./assets/img/line.png" alt="line" style="display: block; margin-top:20px;margin-bottom:20px;width:500px;"/> <br> </div>
|
|
621
|
+
|
|
586
622
|
- ### Query Builder
|
|
587
623
|
|
|
588
624
|
```typescript
|
|
@@ -671,6 +707,8 @@
|
|
|
671
707
|
});
|
|
672
708
|
```
|
|
673
709
|
|
|
710
|
+
<div align="center"> <img src="./assets/img/line.png" alt="line" style="display: block; margin-top:20px;margin-bottom:20px;width:500px;"/> <br> </div>
|
|
711
|
+
|
|
674
712
|
- ### Transactions
|
|
675
713
|
|
|
676
714
|
```typescript
|
|
@@ -711,6 +749,8 @@
|
|
|
711
749
|
});
|
|
712
750
|
```
|
|
713
751
|
|
|
752
|
+
<div align="center"> <img src="./assets/img/line.png" alt="line" style="display: block; margin-top:20px;margin-bottom:20px;width:500px;"/> <br> </div>
|
|
753
|
+
|
|
714
754
|
- ### Raw SQL
|
|
715
755
|
|
|
716
756
|
```typescript
|
|
@@ -762,7 +802,7 @@
|
|
|
762
802
|
});
|
|
763
803
|
```
|
|
764
804
|
|
|
765
|
-
<
|
|
805
|
+
<br>
|
|
766
806
|
|
|
767
807
|
- ## Advanced Features
|
|
768
808
|
|
|
@@ -792,6 +832,8 @@
|
|
|
792
832
|
};
|
|
793
833
|
```
|
|
794
834
|
|
|
835
|
+
<div align="center"> <img src="./assets/img/line.png" alt="line" style="display: block; margin-top:20px;margin-bottom:20px;width:500px;"/> <br> </div>
|
|
836
|
+
|
|
795
837
|
- ### Cookie Management
|
|
796
838
|
|
|
797
839
|
```typescript
|
|
@@ -838,6 +880,8 @@
|
|
|
838
880
|
});
|
|
839
881
|
```
|
|
840
882
|
|
|
883
|
+
<div align="center"> <img src="./assets/img/line.png" alt="line" style="display: block; margin-top:20px;margin-bottom:20px;width:500px;"/> <br> </div>
|
|
884
|
+
|
|
841
885
|
- ### Dynamic Routing
|
|
842
886
|
|
|
843
887
|
```typescript
|
|
@@ -873,6 +917,8 @@
|
|
|
873
917
|
});
|
|
874
918
|
```
|
|
875
919
|
|
|
920
|
+
<div align="center"> <img src="./assets/img/line.png" alt="line" style="display: block; margin-top:20px;margin-bottom:20px;width:500px;"/> <br> </div>
|
|
921
|
+
|
|
876
922
|
- ### Health Checks
|
|
877
923
|
|
|
878
924
|
```typescript
|
|
@@ -899,6 +945,8 @@
|
|
|
899
945
|
}
|
|
900
946
|
```
|
|
901
947
|
|
|
948
|
+
<div align="center"> <img src="./assets/img/line.png" alt="line" style="display: block; margin-top:20px;margin-bottom:20px;width:500px;"/> <br> </div>
|
|
949
|
+
|
|
902
950
|
- ### Graceful Shutdown
|
|
903
951
|
|
|
904
952
|
```typescript
|
|
@@ -924,6 +972,8 @@
|
|
|
924
972
|
});
|
|
925
973
|
```
|
|
926
974
|
|
|
975
|
+
<div align="center"> <img src="./assets/img/line.png" alt="line" style="display: block; margin-top:20px;margin-bottom:20px;width:500px;"/> <br> </div>
|
|
976
|
+
|
|
927
977
|
- ### Dynamic Routes
|
|
928
978
|
|
|
929
979
|
```typescript
|
|
@@ -951,6 +1001,8 @@
|
|
|
951
1001
|
console.log(routes);
|
|
952
1002
|
```
|
|
953
1003
|
|
|
1004
|
+
<div align="center"> <img src="./assets/img/line.png" alt="line" style="display: block; margin-top:20px;margin-bottom:20px;width:500px;"/> <br> </div>
|
|
1005
|
+
|
|
954
1006
|
- ### Request Timeout
|
|
955
1007
|
|
|
956
1008
|
```typescript
|
|
@@ -970,6 +1022,8 @@
|
|
|
970
1022
|
});
|
|
971
1023
|
```
|
|
972
1024
|
|
|
1025
|
+
<div align="center"> <img src="./assets/img/line.png" alt="line" style="display: block; margin-top:20px;margin-bottom:20px;width:500px;"/> <br> </div>
|
|
1026
|
+
|
|
973
1027
|
- ### Custom Error Handling
|
|
974
1028
|
|
|
975
1029
|
```typescript
|
|
@@ -1010,11 +1064,9 @@
|
|
|
1010
1064
|
<!-- ╔══════════════════════════════ END ══════════════════════════════╗ -->
|
|
1011
1065
|
|
|
1012
1066
|
<br>
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
</div>
|
|
1017
|
-
<br>
|
|
1067
|
+
|
|
1068
|
+
---
|
|
1069
|
+
|
|
1018
1070
|
<div align="center">
|
|
1019
1071
|
<a href="https://github.com/solution-lib/space"><img src="https://img.shields.io/badge/by-Space-black"/></a>
|
|
1020
1072
|
</div>
|