kempo-server 1.3.0 → 1.4.3
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/.github/copilot-instructions.md +96 -0
- package/README.md +212 -4
- package/docs/configuration.html +119 -0
- package/docs/examples.html +201 -0
- package/docs/getting-started.html +72 -0
- package/docs/index.html +53 -330
- package/docs/manifest.json +87 -0
- package/docs/media/hexagon.svg +22 -0
- package/docs/media/icon-maskable.png +0 -0
- package/docs/media/icon.svg +44 -0
- package/docs/media/icon128.png +0 -0
- package/docs/media/icon144.png +0 -0
- package/docs/media/icon152.png +0 -0
- package/docs/media/icon16-48.svg +21 -0
- package/docs/media/icon16.png +0 -0
- package/docs/media/icon192.png +0 -0
- package/docs/media/icon256.png +0 -0
- package/docs/media/icon32.png +0 -0
- package/docs/media/icon384.png +0 -0
- package/docs/media/icon48.png +0 -0
- package/docs/media/icon512.png +0 -0
- package/docs/media/icon64.png +0 -0
- package/docs/media/icon72.png +0 -0
- package/docs/media/icon96.png +0 -0
- package/docs/media/kempo-fist.svg +21 -0
- package/docs/middleware.html +147 -0
- package/docs/request-response.html +95 -0
- package/docs/routing.html +77 -0
- package/package.json +8 -3
- package/tests/builtinMiddleware-cors.node-test.js +17 -0
- package/tests/builtinMiddleware.node-test.js +74 -0
- package/tests/defaultConfig.node-test.js +13 -0
- package/tests/example-middleware.node-test.js +31 -0
- package/tests/findFile.node-test.js +46 -0
- package/tests/getFiles.node-test.js +25 -0
- package/tests/getFlags.node-test.js +30 -0
- package/tests/index.node-test.js +23 -0
- package/tests/middlewareRunner.node-test.js +18 -0
- package/tests/requestWrapper.node-test.js +51 -0
- package/tests/responseWrapper.node-test.js +74 -0
- package/tests/router-middleware.node-test.js +46 -0
- package/tests/router.node-test.js +88 -0
- package/tests/serveFile.node-test.js +52 -0
- package/tests/test-utils.js +106 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
3
|
+
|
|
4
|
+
<svg
|
|
5
|
+
version="1.1"
|
|
6
|
+
id="svg1"
|
|
7
|
+
width="649.8299"
|
|
8
|
+
height="590.10803"
|
|
9
|
+
viewBox="0 0 649.8299 590.10803"
|
|
10
|
+
sodipodi:docname="hexagon-purple.png"
|
|
11
|
+
xml:space="preserve"
|
|
12
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
13
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
xmlns:svg="http://www.w3.org/2000/svg"><defs
|
|
16
|
+
id="defs1" /><sodipodi:namedview
|
|
17
|
+
id="namedview1"
|
|
18
|
+
pagecolor="#505050"
|
|
19
|
+
bordercolor="#eeeeee"
|
|
20
|
+
borderopacity="1"
|
|
21
|
+
inkscape:showpageshadow="0"
|
|
22
|
+
inkscape:pageopacity="0"
|
|
23
|
+
inkscape:pagecheckerboard="0"
|
|
24
|
+
inkscape:deskcolor="#505050"><inkscape:page
|
|
25
|
+
x="0"
|
|
26
|
+
y="0"
|
|
27
|
+
width="649.8299"
|
|
28
|
+
height="590.10803"
|
|
29
|
+
id="page2"
|
|
30
|
+
margin="0"
|
|
31
|
+
bleed="0" /></sodipodi:namedview><g
|
|
32
|
+
inkscape:groupmode="layer"
|
|
33
|
+
inkscape:label="Image"
|
|
34
|
+
id="g1"
|
|
35
|
+
transform="translate(-13.952438,-46.045254)"><path
|
|
36
|
+
style="fill:#673ab7;fill-opacity:1;stroke-width:1.1343"
|
|
37
|
+
d="M 201.25483,633.44559 C 171.59431,626.08319 148.08435,604.24754 135.40375,576.83656 95.168132,508.29466 54.280408,440.0203 17.236327,369.69641 11.027202,340.78807 12.510305,308.92478 31.436972,284.79334 70.904785,216.66071 107.86861,146.91989 150.81338,80.896968 c 17.96951,-25.695004 50.14409,-36.007035 80.44786,-33.848811 79.36796,-0.211081 158.84329,-2.514892 238.15151,0.668214 30.4638,3.419652 55.96804,24.597126 69.6988,51.393764 41.6121,69.726815 82.29894,140.074595 120.9384,211.489465 6.49009,27.68675 5.68634,58.85541 -11.86428,82.53153 -39.19696,69.12611 -77.21663,139.06952 -119.67593,206.24588 -21.62307,30.2638 -59.7125,38.61039 -94.77866,36.01681 -77.44887,0.48438 -155.12886,2.18689 -232.47625,-1.94823 z"
|
|
38
|
+
id="path3"
|
|
39
|
+
inkscape:export-filename="..\..\dev\kempo-server\docs\media\hexagon.svg"
|
|
40
|
+
inkscape:export-xdpi="96"
|
|
41
|
+
inkscape:export-ydpi="96" /><path
|
|
42
|
+
id="path1"
|
|
43
|
+
style="fill:#ffffff;fill-opacity:1;stroke-width:0.423233"
|
|
44
|
+
d="m 353.19249,105.37155 c -10.0632,0.1717 -20.05607,2.74781 -29.00402,7.34099 -6.75106,3.42199 -12.92882,7.88085 -18.65532,12.80929 -0.88209,0.73333 -1.8156,1.51642 -2.67403,2.20835 -0.66904,0.52914 -1.2731,1.01159 -1.96075,1.51521 -0.8202,0.60251 -1.66303,1.1745 -2.53197,1.70451 -0.17562,0.099 -0.47857,0.28764 -0.70926,0.41075 -2.60488,1.50677 -5.57734,2.23759 -8.54483,2.58825 -0.4953,0.0596 -1.09737,0.1242 -1.63584,0.17061 -1.70855,0.15469 -3.4154,0.24477 -5.14773,0.29859 -9.55368,0.32318 -19.20427,-0.10573 -28.76692,0.71195 -5.97002,0.50369 -11.9659,1.69446 -17.39858,4.29664 -5.95001,2.82963 -11.12251,7.00372 -16.03297,11.33957 -7.02397,6.20542 -13.57141,12.92334 -20.61198,19.1093 -0.39654,0.27604 -0.90307,0.33244 -1.34533,0.51805 -4.96082,1.64833 -10.0502,2.99835 -15.09673,4.42554 -6.83345,1.92332 -13.68576,3.829 -20.33638,6.32817 -5.0364,1.92995 -9.79664,4.5369 -14.25266,7.56606 -5.97749,4.06976 -11.26884,9.15518 -15.50644,15.01894 -5.31514,7.322 -9.00354,15.70507 -11.66396,24.31987 -2.6792,8.7249 -4.38538,17.71571 -5.71361,26.73488 -0.79357,5.35046 -1.44394,10.72184 -1.92708,16.10925 -0.88478,9.71752 -1.37141,19.46542 -1.87227,29.20842 -0.68092,13.84298 -1.31039,27.69243 -2.08616,41.52309 -0.45135,8.45497 -0.51274,16.92425 -0.54343,25.38941 -0.0174,9.84561 0.0291,19.69561 0.47253,29.53263 0.37507,6.57122 1.27615,13.19232 3.6149,19.37837 1.99194,5.33916 5.08712,10.22688 8.84387,14.49689 2.97948,3.41844 6.29422,6.55725 9.94366,9.25325 5.35899,3.92822 11.45414,6.81598 17.84033,8.62754 4.10897,1.18729 8.31855,2.05778 12.57778,2.47318 7.36716,0.60702 14.80083,-0.7388 21.70628,-3.29098 2.96014,-1.07859 5.83454,-2.37507 8.68701,-3.7084 5.14939,3.11229 10.36284,6.20874 16.03137,8.29125 5.98239,2.26304 12.22994,3.76685 18.53377,4.80619 7.20703,1.14605 14.59994,1.31253 21.81558,0.14475 2.1928,-0.32596 4.37751,-0.7086 6.57608,-0.99818 0.10178,2.5347 0.0795,5.13603 0.1514,7.7024 0.10066,4.36786 0.29771,8.77335 1.31679,13.03872 0.64199,2.60028 1.69834,5.08098 2.98771,7.42332 4.98819,9.44879 12.6881,17.38257 21.79779,22.92878 6.06867,3.76952 12.51998,6.86947 19.00574,9.84475 6.72764,3.04348 13.60011,5.75132 20.4803,8.42688 5.34774,2.2163 10.59368,4.66723 15.93679,6.8943 5.5026,2.31303 11.03566,4.55366 16.53597,6.87252 8.30432,3.45807 16.61771,6.91953 25.13367,9.83032 4.31213,1.44402 8.75791,2.56023 13.29782,2.95573 3.65448,0.35271 7.35055,0.29984 10.98925,-0.19753 5.03285,-0.6176 10.13727,-1.17132 15.10247,-2.32613 4.9952,-1.15001 9.8264,-2.90088 14.5961,-4.75688 4.9674,-1.96457 9.8722,-4.08341 14.7794,-6.19318 8.0251,-3.47983 16.0203,-6.98802 24.0736,-10.39888 8.5279,-3.62802 17.1094,-7.15958 25.5438,-11.01385 8.3985,-3.81163 16.7251,-7.78354 24.943,-11.97203 3.2393,-1.66679 6.4781,-3.35226 9.5487,-5.31791 4.7948,-3.13919 9.115,-6.94126 13.2295,-10.91494 3.7694,-3.70033 7.3408,-7.63331 10.3556,-11.97965 2.2747,-3.37759 3.8237,-7.17494 5.1762,-10.99715 1.3424,-3.87964 2.3905,-7.85995 3.1833,-11.88677 0.5519,-2.94651 0.7207,-5.94687 0.7618,-8.93933 0.058,-3.77676 0.031,-7.55429 0.03,-11.33135 -0.024,-5.89207 -0.2245,-11.8038 -1.1477,-17.63218 -0.7111,-4.8197 -1.5703,-9.61751 -2.5554,-14.38858 -1.9129,-9.05437 -4.5298,-17.94954 -7.5932,-26.67788 -1.3327,-3.84948 -2.6997,-7.68777 -3.9481,-11.56589 -2.4057,-7.57179 -4.6336,-15.28096 -6.6437,-22.9979 -1.3307,-5.07501 -2.5852,-10.21727 -3.6395,-15.37664 -0.1242,-0.62872 -0.2681,-1.32641 -0.383,-1.95417 -0.4637,-2.39116 -0.7832,-4.80827 -0.9647,-7.23708 -0.5198,-6.13157 -0.8102,-12.26782 -1.0943,-18.42593 -0.747,-16.94755 -1.009,-33.92517 -2.4349,-50.83562 -0.5961,-6.72377 -1.4353,-13.45328 -3.1031,-20.00489 -0.9947,-3.94558 -2.3313,-7.79819 -3.8912,-11.5544 -1.4094,-3.40338 -2.8884,-6.79219 -3.8889,-10.3453 -0.8827,-3.03302 -1.354,-6.16029 -2.0219,-9.24295 -1.866,-9.04396 -4.0986,-18.07649 -7.7951,-26.56794 -2.3881,-5.54529 -5.1541,-10.94156 -8.459,-15.99931 -2.843,-4.31941 -6.1706,-8.31047 -9.8295,-11.96074 -3.4874,-3.54674 -7.2562,-6.86362 -11.5261,-9.44279 -3.4019,-2.09197 -6.9866,-3.88095 -10.6697,-5.42109 -4.4146,-1.81656 -9.0568,-3.10703 -13.8014,-3.67509 -9.231,-1.19003 -18.5671,-0.33942 -27.8027,0.12426 -3.381,0.17408 -6.7638,0.31123 -10.1478,0.41107 -2.5291,0.0476 -5.1466,0.11553 -7.7068,-0.0315 -0.7201,-0.0429 -1.5214,-0.13883 -2.1813,-0.24793 -2.19705,-0.34226 -4.2705,-1.17615 -6.32272,-1.99837 -3.59616,-1.48657 -7.10316,-3.1769 -10.63724,-4.80304 -5.62407,-2.61483 -11.27221,-5.24623 -17.21374,-7.06892 -5.60641,-1.67466 -11.3957,-2.72231 -17.22446,-3.20798 -2.31341,-0.17621 -4.63432,-0.24844 -6.9543,-0.21557 z m 3.47184,18.51977 c 1.11398,0.01 2.24727,0.0369 3.32439,0.0999 0.46191,0.0208 0.90738,0.059 1.39781,0.0931 7.86892,0.61579 15.65018,2.63527 22.747,6.10844 2.91589,1.43345 5.70538,3.12964 8.2932,5.0961 0.43138,0.32989 0.93535,0.72947 1.38312,1.10143 0.79733,0.66277 1.56909,1.35623 2.31521,2.07613 0.31903,0.31541 0.71651,0.70774 1.05308,1.06614 1.11894,1.19764 2.21018,2.4385 3.09328,3.82337 0.90369,1.47107 1.41168,3.14012 1.76753,4.81802 0.48064,1.95183 1.39628,3.92608 3.08952,5.10686 2.01976,1.39011 4.96485,1.11109 6.73163,-0.57325 1.8589,-1.49881 2.9137,-3.69529 4.4024,-5.51444 0.1585,-0.18485 0.406,-0.47728 0.612,-0.69337 2.4476,-2.62715 5.6426,-4.40616 8.9079,-5.8169 2.2454,-0.97651 4.652,-1.77525 6.9962,-2.29744 0.8405,-0.18819 1.7687,-0.35485 2.5683,-0.47531 2.543,-0.3745 5.1268,-0.45508 7.6893,-0.25873 0.4205,0.0334 0.9258,0.0779 1.3771,0.12812 0.263,0.0318 0.6621,0.0771 0.9771,0.1235 3.2999,0.47228 6.5118,1.20811 9.7265,2.11399 6.3148,1.80196 12.4176,4.37195 18.0697,7.72089 0.5599,0.33614 1.2002,0.72224 1.7818,1.09317 3.8942,2.48611 7.5899,5.33741 10.7282,8.74191 4.0294,4.39013 6.8078,9.76159 8.9862,15.26667 1.6753,4.27683 3.0144,8.67537 4.6131,12.98026 1.7935,4.95646 3.4127,10.00999 5.1996,14.98336 2.6475,7.48016 5.4268,14.91925 7.7517,22.50907 0.4013,1.33398 0.821,2.73484 1.1891,4.0786 1.1732,4.22644 2.1438,8.51074 2.8573,12.83916 0.5551,3.43079 0.9974,6.95391 1.272,10.44667 0.05,0.61436 0.091,1.29536 0.139,1.94696 0.032,0.5885 0.074,1.27522 0.1029,1.90273 0.3682,8.65505 0,17.31692 -0.1844,25.97166 -0.073,2.61755 -0.1785,5.28145 -0.3191,7.89025 -0.2753,5.2083 -0.817,10.45846 -1.117,15.69153 -0.3396,6.05535 -0.03,12.15371 1.0465,18.12551 1.2776,7.18658 3.4797,14.17079 5.3672,21.19839 1.0934,4.00648 2.2912,7.98392 3.5785,11.93257 2.5574,7.8948 5.2302,15.75284 7.7605,23.65709 2.2297,6.90555 4.4026,13.8508 6.4204,20.79518 1.5516,5.32574 2.9987,10.65523 4.2521,16.0577 0.4356,1.88476 0.8646,3.88497 1.235,5.79467 0.4223,2.20073 0.7971,4.44241 1.0798,6.63488 0.3519,2.69512 0.5778,5.4073 0.6528,8.12456 0.015,0.68443 0.03,1.45893 0.024,2.17931 0,0.84555 -0.023,1.6909 -0.056,2.53577 -0.024,0.43168 -0.046,0.97815 -0.084,1.45322 -0.1041,1.38682 -0.2921,2.76649 -0.544,4.13396 -0.052,0.25904 -0.1107,0.58564 -0.1718,0.87319 -0.6278,2.98178 -1.4467,5.92112 -2.3484,8.83074 -1.2542,4.01918 -2.9343,7.89437 -5.2083,11.4482 -1.992,3.12243 -4.3799,5.99301 -7.097,8.51058 -0.5328,0.49046 -1.1376,1.03705 -1.715,1.53032 -1.7246,1.4818 -3.5399,2.85604 -5.4122,4.14531 -0.5952,0.40417 -1.2658,0.85631 -1.9018,1.26235 -4.1927,2.71399 -8.6634,4.95768 -13.1264,7.18539 -9.509,4.70254 -19.1976,9.03099 -28.9501,13.20164 -13.1225,5.6691 -26.085,11.6948 -39.0324,17.74913 -7.2318,3.3613 -14.4599,6.71644 -21.8231,9.76481 -0.9584,0.39324 -1.8553,0.75442 -2.8272,1.12273 -2.0524,0.78335 -4.1873,1.51171 -6.2739,2.07999 -1.1394,0.30997 -2.28953,0.58135 -3.44955,0.80182 2.11797,-2.58646 3.67005,-5.57915 4.96485,-8.64639 1.9947,-4.78429 3.2388,-9.85659 3.9878,-14.9773 0.859,-6.0763 0.8391,-12.29987 -0.3244,-18.33497 -0.5904,-3.2403 -1.3306,-6.46007 -2.3445,-9.59549 -0.6376,-1.92865 -1.5115,-3.91135 -3.17304,-5.17473 -1.39518,-1.09026 -3.3234,-1.567 -5.02702,-0.98222 -2.14611,0.70531 -3.70696,2.90992 -3.58253,5.17808 0.0343,1.48365 0.38657,2.93435 0.54444,4.40605 0.19701,1.43081 0.35246,2.85233 0.47531,4.27032 0.22958,2.64729 0.32911,5.36767 0.27649,8.05301 -0.0457,2.489 -0.23674,5.01603 -0.56374,7.52223 -0.0835,0.62575 -0.16617,1.18484 -0.26204,1.80867 -0.10212,0.64245 -0.22804,1.37575 -0.35677,2.05065 -1.10278,5.94005 -3.04111,11.69319 -5.3792,17.25358 -0.62901,1.517 -1.33684,3.0725 -1.95176,4.62323 -0.40427,1.08194 -0.87228,2.20364 -0.74387,3.38433 -1.55822,-0.0592 -3.08519,-0.43771 -4.53391,-1.00217 -3.03739,-1.09948 -6.04309,-2.28349 -9.05321,-3.45485 -6.58578,-2.59006 -13.07539,-5.47076 -19.21083,-9.01186 -4.56753,-2.60117 -8.95578,-5.37144 -13.35437,-8.26431 -1.3671,-0.90269 -2.73179,-1.80917 -4.09011,-2.72508 0.48509,-9.19203 0.85581,-18.39314 0.8546,-27.59943 -0.004,-2.74256 -0.009,-5.48958 -0.20735,-8.2258 -0.20993,-2.05668 -0.82723,-4.06502 -1.79486,-5.89094 -1.33542,-2.81156 -3.28932,-5.38369 -5.88348,-7.14296 -3.14105,-2.2696 -6.75724,-3.73473 -10.30424,-5.23524 -3.23924,-1.33237 -6.51191,-2.58217 -9.79377,-3.80512 6.01384,0.0457 12.03341,0.0282 18.03873,-0.3245 1.83606,-0.117 3.67763,-0.26952 5.47122,-0.69967 2.44509,-0.57495 4.85838,-1.27901 7.26105,-2.00919 5.26181,-1.63106 10.43746,-3.53371 15.5346,-5.62091 2.73825,-1.15148 5.43558,-2.39996 8.0832,-3.7468 3.10623,1.25504 6.26979,2.36916 9.49004,3.29466 7.02226,2.12718 14.11449,4.02382 21.2559,5.70666 3.60134,0.76972 7.29915,0.83938 10.96442,0.99547 6.4331,0.20509 12.8704,0.2678 19.3063,0.33821 4.5448,0.0279 9.0937,0.0772 13.6346,-0.14356 3.6846,-0.19141 7.3683,-0.67321 10.9215,-1.69089 3.0818,-0.85432 6.1083,-1.89431 9.1279,-2.94425 4.1011,-1.45303 8.1439,-3.17184 11.7741,-5.59722 4.7914,-3.17226 8.7664,-7.47793 11.861,-12.3 2.6052,-4.04303 4.7225,-8.38263 6.5601,-12.82155 1.6068,-3.87538 1.7814,-8.136 2.9923,-12.12497 1.8081,-6.54703 3.5948,-13.11064 4.7802,-19.80476 1.9423,-11.11294 3.7244,-22.26087 4.9296,-33.48074 0.5086,-4.83712 0.9619,-9.68349 1.1881,-14.54296 0.2677,-5.76845 0.1826,-11.54984 -0.1722,-17.31262 -0.7932,-13.54819 -2.9156,-27.02238 -6.3863,-40.14372 -0.8848,-2.96343 -1.792,-5.95279 -3.2617,-8.68749 -1.0641,-1.78414 -3.1667,-3.00735 -5.2693,-2.71979 -2.4101,0.25968 -4.4916,2.42608 -4.5256,4.87305 -0.1171,1.33773 0.01,2.69641 0.027,4.00711 0.2063,5.51229 0.5864,11.05188 0.7743,16.54277 0.3863,12.31359 0.2895,24.63823 -0.1072,36.95023 -0.1431,4.12021 -0.2642,8.26351 -0.5202,12.38705 -0.2304,2.8368 -0.6739,5.65129 -1.1097,8.46238 -1.4207,8.76923 -3.0578,17.49253 -4.809,26.20639 -0.9396,3.63864 -1.9588,7.25601 -2.9445,10.88232 -1.4859,5.37898 -2.9853,10.758 -4.7461,16.05472 -0.6107,1.79454 -1.2826,3.60277 -1.9885,5.30751 -1.9758,4.74942 -4.3385,9.41414 -7.6911,13.35201 -2.3938,2.8305 -5.3412,5.18242 -8.6228,6.90527 -1.8677,0.97424 -3.807,1.8327 -5.8271,2.43797 -1.5272,0.42214 -3.1276,0.41968 -4.6989,0.49838 -3.9889,0.13728 -7.9805,0.18474 -11.9712,0.23688 -5.0816,0.0524 -10.1649,0.0841 -15.2453,-0.0637 -0.8379,-0.0295 -1.7601,-0.0647 -2.6306,-0.10761 -3.4609,-0.16737 -6.9461,-0.44653 -10.38486,-1.03859 -0.81823,-0.13528 -1.63447,-0.28937 -2.41529,-0.44836 -4.00449,-0.81925 -8.00211,-2.02801 -11.78699,-3.64841 -1.39163,-0.60763 -2.82676,-1.30087 -4.10726,-2.0297 -2.46558,-1.42665 -4.85662,-3.14912 -6.48076,-5.53014 -0.0972,-1.54456 0.0315,-3.09851 0.11636,-4.64318 0.17385,-2.75305 0.18496,-5.51316 0.28067,-8.26954 0.11331,-4.28913 0.23966,-8.57559 0.48166,-12.86814 0.59109,-10.59901 1.58515,-21.23452 2.60151,-31.82538 1.6329,-16.92322 2.92614,-33.88483 3.55576,-50.87761 0.66948,-16.72754 1.24996,-33.45867 1.96822,-50.18422 0.21533,-4.66445 0.43531,-9.33226 0.75333,-13.97396 0.0699,-1.61691 0.55151,-3.19951 0.48416,-4.82355 -0.0642,-1.62421 -0.76175,-3.27521 -2.10293,-4.24728 -1.80565,-1.37075 -4.56073,-1.41336 -6.31075,0.078 -1.47463,1.11655 -2.17773,2.89709 -2.82588,4.56518 -2.09667,5.48332 -3.02798,11.30727 -4.07949,17.05588 -2.00329,11.51327 -3.42447,23.11852 -4.68989,34.73335 -1.64016,15.29647 -2.935,30.62802 -4.10789,45.96706 -0.85662,11.28143 -1.62529,22.56857 -2.38379,33.85707 -0.30699,4.36198 -0.6315,8.79173 -1.00435,13.13511 -0.31716,3.49056 -0.651,6.96699 -1.10465,10.45705 -0.5633,4.19193 -1.21282,8.43037 -2.5926,12.4612 -1.19278,3.48141 -2.99915,6.78746 -5.53669,9.47333 -2.05057,2.20756 -4.39595,4.19093 -6.80594,5.94494 -1.24686,0.9073 -2.54507,1.7868 -3.82665,2.58362 -3.23594,2.02601 -6.62664,3.8025 -10.12353,5.33382 -1.13508,0.48965 -2.37775,1.0068 -3.58432,1.4547 -2.41812,0.90815 -4.8433,1.6766 -7.36013,2.2697 -1.62702,0.39447 -3.29541,0.5936 -4.96648,0.66416 -0.43149,0.0189 -0.97615,0.0316 -1.45221,0.0301 -5.46861,-0.0214 -10.84531,-1.20715 -16.12929,-2.51189 -1.43114,-0.35502 -2.82638,-0.68844 -4.24312,-1.11738 -0.19493,-0.0603 -0.53409,-0.16826 -0.78447,-0.24716 -0.75613,-0.25567 -1.46965,-0.51266 -2.18071,-0.82415 -3.31482,-1.42348 -6.46343,-3.39052 -8.87461,-6.10382 -0.72183,-0.82996 -1.34385,-1.8084 -1.45102,-2.92867 -0.12378,-0.72314 -0.22453,-1.53585 -0.29565,-2.21048 -0.30237,-3.14811 -0.42438,-6.30989 -0.52573,-9.46985 -0.0177,-0.84226 -0.0401,-1.77064 -0.0595,-2.64603 -0.27871,-12.92179 -0.27973,-25.84732 -0.29636,-38.77149 0.0214,-9.3648 0.26753,-18.72707 0.45891,-28.08944 0.69922,-31.68503 1.64071,-63.42842 -0.47663,-95.08141 -0.12553,-1.57608 -0.16815,-3.16266 -0.38689,-4.72896 -0.401,-1.61476 -1.3434,-3.16885 -2.79566,-4.03478 -1.47394,-0.87133 -3.37269,-0.941 -4.90608,-0.17916 -1.70986,0.80772 -2.83243,2.46963 -3.51981,4.17674 -0.67383,1.72361 -0.99637,3.55628 -1.37862,5.35974 -0.91168,4.71347 -1.48423,9.4846 -1.99857,14.25538 -1.03654,10.19214 -1.28836,20.44113 -1.5697,30.67572 -0.59703,26.28457 -0.63029,52.57716 -0.90646,78.86602 -0.10752,10.15952 -0.21894,20.31973 -0.49209,30.47638 -0.12085,4.13631 -0.28635,8.31239 -0.60533,12.45495 -0.22029,2.41139 -0.45553,4.85872 -1.31794,7.14128 -1.28335,3.48538 -2.81744,6.98289 -5.35569,9.752 -2.14949,2.35086 -5.09774,3.83655 -8.15448,4.62095 -0.87789,0.23936 -1.80377,0.43833 -2.65736,0.58895 -2.10491,0.37707 -4.26609,0.5661 -6.36988,0.68019 -6.7877,0.35503 -13.68075,-0.37364 -20.2372,-2.24073 -4.24462,-1.245 -8.45186,-2.88128 -12.04134,-5.51617 -2.88597,-2.15376 -5.52227,-4.67815 -7.62831,-7.60748 -0.85769,-1.25362 -1.71373,-2.60799 -1.85889,-4.15717 -0.0648,-0.45076 -0.11702,-1.04362 -0.14998,-1.55718 -0.0555,-0.82085 -0.0802,-1.75791 -0.13026,-2.6296 -0.49884,-11.54822 -0.64945,-23.1161 -0.73664,-34.68057 -0.15233,-26.65888 0.0434,-53.31988 0.59179,-79.97356 0.10135,-4.44319 0.2159,-8.88607 0.3447,-13.32855 0.15443,-4.37873 0.30058,-8.83417 0.56221,-13.20649 0.11603,-2.3509 0.35455,-4.69265 0.62871,-7.02968 0.37002,-3.3391 0.75624,-6.70063 0.56319,-10.06469 -0.17089,-1.79884 -1.00385,-3.62545 -2.56585,-4.62168 -1.90486,-1.26365 -4.60648,-1.0381 -6.32633,0.44732 -1.27586,1.07379 -1.83119,2.71354 -2.35147,4.24185 -1.95796,6.37919 -3.55022,12.86858 -4.87842,19.40716 -1.0962,5.84632 -1.42418,11.79763 -1.78391,17.72428 -0.60576,10.97476 -0.94597,21.96334 -1.2886,32.94854 -0.7232,24.0641 -1.20462,48.13459 -1.86708,72.20031 -0.14549,4.87882 -0.31696,9.75967 -0.56706,14.64205 -0.11932,2.11121 -0.22887,4.27345 -0.41331,6.39976 -0.0486,0.49693 -0.10078,1.10151 -0.16276,1.63918 -0.21097,1.68581 -0.37475,3.41031 -1.00196,5.0036 -0.36797,0.9066 -1.03787,1.72494 -1.9773,2.06905 -1.42387,0.56737 -2.9855,0.40305 -4.48247,0.44159 -3.07313,3.8e-4 -6.14451,-0.1185 -9.2164,-0.19112 -2.6928,-0.0927 -5.44202,-0.15349 -8.13898,-0.4778 -0.32311,-0.0427 -0.5775,-0.08 -0.91866,-0.14339 -1.83702,-0.3151 -3.5799,-1.00537 -5.25815,-1.79738 -2.79042,-1.29703 -5.57717,-2.70071 -7.92793,-4.71623 -1.9566,-1.62856 -3.61362,-3.61235 -4.85495,-5.83584 -2.11971,-3.68721 -3.34417,-7.80172 -4.3491,-11.91023 -1.0029,-4.21121 -1.74518,-8.49067 -2.38895,-12.74029 -1.0219,-6.91444 -1.69932,-13.96153 -2.07255,-20.93686 -0.1257,-2.31381 -0.21936,-4.62311 -0.27659,-6.92152 -0.20477,-7.90922 -0.001,-15.79103 0.42382,-23.6843 0.71412,-13.27516 1.99391,-26.56597 2.9339,-39.85139 0.87705,-12.31079 1.47591,-24.62641 2.7514,-36.89698 0.6189,-6.04426 1.50248,-12.10305 3.0032,-18.01391 0.53047,-2.15655 1.12472,-4.34985 1.73078,-6.45287 1.40053,-4.73806 2.97872,-9.43048 4.89306,-13.98742 1.31827,-3.04547 2.67302,-6.15491 4.88204,-8.67722 1.93458,-2.33968 4.02783,-4.54542 6.22594,-6.63848 0.71815,-0.67837 1.52232,-1.42081 2.2634,-2.07884 2.4257,-2.17062 4.97259,-4.22653 7.77814,-5.88995 5.48508,-3.32948 11.46954,-5.87551 17.72732,-7.32406 0.4723,-0.10814 0.87209,-0.19083 1.34993,-0.28909 0.55422,-0.11143 1.20763,-0.23127 1.8036,-0.32536 0.72818,-0.11878 1.47874,-0.22318 2.17239,-0.29848 0.51934,-0.0615 1.06489,-0.10941 1.62239,-0.15166 2.13238,-0.13085 4.31566,-0.24035 6.40572,0.28958 1.15124,0.28344 2.20547,0.91682 2.97952,1.81706 1.66155,1.84132 2.40912,4.25798 3.64692,6.36476 0.86467,1.44589 2.14556,2.79578 3.8443,3.18008 2.12889,0.52151 4.60616,-0.3809 5.70094,-2.32633 0.77244,-1.31288 1.00526,-2.84269 1.45786,-4.27733 1.16266,-4.17917 2.32168,-8.34161 3.84934,-12.39419 2.36542,-6.29582 5.35185,-12.42692 9.51561,-17.74188 3.46176,-4.42857 7.73769,-8.28389 12.72687,-10.91458 0.17027,-0.0887 0.43756,-0.22908 0.62585,-0.32131 1.4556,-0.73656 3.04694,-1.40932 4.62285,-1.96653 1.55697,-0.55407 3.22895,-1.03999 4.87175,-1.42615 1.83003,-0.40791 3.67146,-0.83161 5.55076,-0.91925 0.18469,-0.008 0.51816,-0.0164 0.76429,-0.0116 1.67206,0.0634 3.336,0.2704 4.99807,0.45731 5.02307,0.63757 10.02935,1.40122 15.0298,2.19534 4.66066,0.75349 9.34929,1.55795 14.00245,2.4339 0.89574,0.17461 1.79089,0.35281 2.68138,0.55271 -0.10793,2.49115 -0.35158,4.97284 -0.59282,7.45371 -0.14478,1.66864 -0.28679,3.34652 -0.21439,5.02184 0.17502,2.05301 1.60523,3.98626 3.59935,4.59628 2.20724,0.73424 4.81136,-0.13738 6.16329,-2.02346 1.61378,-2.00371 2.40286,-4.49759 3.23171,-6.89343 0.55471,-1.72125 1.28286,-3.43471 2.05797,-5.09877 0.32522,-0.7068 0.63426,-1.38977 0.96228,-2.06718 0.47097,-0.98905 0.95332,-1.96839 1.43984,-2.91979 1.55336,-3.03773 3.19176,-6.03553 4.98862,-8.93667 0.36331,-0.58012 0.7465,-1.16136 1.1113,-1.69351 0.43698,-0.6387 0.8834,-1.23902 1.34102,-1.83163 2.62567,-3.38745 5.77948,-6.35307 9.26296,-8.84471 0.19801,-0.13598 0.4785,-0.34033 0.68204,-0.47825 5.97372,-4.11319 12.81528,-6.88241 19.87876,-8.45661 2.67881,-0.59194 5.45428,-0.96093 8.1612,-1.13182 1.25852,-0.0782 2.51944,-0.10852 3.78017,-0.11903 z m -74.1948,328.44731 c -2.32148,2.4429 -3.81101,5.53362 -4.94977,8.67159 -1.29635,3.65472 -2.2049,7.43383 -3.0024,11.22451 -0.18915,-0.88005 -0.32449,-1.86772 -0.39678,-2.7039 -0.37984,-4.42809 0.59907,-9.02264 3.06337,-12.75233 0.83249,-1.24926 1.78517,-2.44411 2.95458,-3.39405 0.73152,-0.55232 1.57922,-0.9428 2.46242,-1.18139 -0.0438,0.0452 -0.0876,0.0904 -0.13142,0.13557 z m 12.79454,9.56078 c 1.9961,0.37731 3.90492,1.095 5.83327,1.71616 6.37089,2.16138 12.63723,4.62182 18.83558,7.23409 1.57886,0.674 3.13885,1.35807 4.67721,2.07573 1.08555,0.52289 2.19204,1.01358 3.23627,1.61436 0.52436,0.32185 0.55155,0.98729 0.7159,1.51731 0.50576,2.47572 0.54785,5.017 0.45877,7.53389 -0.0596,1.68974 -0.14569,3.49471 -0.26347,5.18519 -0.35335,5.22726 -0.87256,10.44651 -1.66175,15.62681 -0.0643,0.36657 -0.14324,0.85485 -0.21603,1.26783 0.0251,0.37826 -0.39366,0.0467 -0.60746,0.0429 -1.88917,-0.55887 -3.75938,-1.19118 -5.60829,-1.8046 -4.12039,-1.38672 -8.19698,-2.90084 -12.24505,-4.48567 -4.09366,-1.61561 -8.21002,-3.31849 -12.23238,-5.15412 -2.5006,-1.14165 -5.04659,-2.34323 -7.49042,-3.66207 -0.85902,-0.46498 -1.69057,-0.94123 -2.51348,-1.49517 -0.085,-2.99651 0.23654,-5.99203 0.72661,-8.94478 0.39528,-2.28622 0.91134,-4.55125 1.54083,-6.7843 0.10087,-0.33697 0.23244,-0.79548 0.34635,-1.17877 0.78014,-2.52785 1.69953,-5.03993 3.06392,-7.31662 0.79392,-1.25841 1.83587,-2.50182 3.29863,-2.97158 0.035,-0.005 0.07,-0.0113 0.10499,-0.0166 z" /></g></svg>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
3
|
+
|
|
4
|
+
<svg
|
|
5
|
+
version="1.1"
|
|
6
|
+
id="svg1"
|
|
7
|
+
width="47.758545"
|
|
8
|
+
height="43.36935"
|
|
9
|
+
viewBox="0 0 47.758545 43.36935"
|
|
10
|
+
xml:space="preserve"
|
|
11
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
12
|
+
xmlns:svg="http://www.w3.org/2000/svg"><defs
|
|
13
|
+
id="defs1" /><g
|
|
14
|
+
id="g1"
|
|
15
|
+
transform="translate(-0.20861354,-1.2175899)"><path
|
|
16
|
+
style="fill:#673ab7;fill-opacity:1;stroke-width:0.0833644"
|
|
17
|
+
d="M 13.9742,44.387935 C 11.794332,43.846845 10.066491,42.242061 9.1345454,40.227527 6.177473,35.190109 3.1724735,30.172351 0.44995936,25.003977 -0.00637352,22.879393 0.10262555,20.537632 1.4936205,18.764116 4.3942643,13.756788 7.1108808,8.6312609 10.267059,3.7789768 c 1.32065,-1.8884255 3.685286,-2.646297 5.912427,-2.4876813 5.833063,-0.015511 11.674015,-0.1848278 17.502682,0.049111 2.238913,0.2513257 4.113316,1.8077392 5.122445,3.7771283 3.058236,5.1244982 6.048468,10.2946312 8.888231,15.5431912 0.476988,2.034808 0.417916,4.325511 -0.871949,6.065561 -2.880737,5.080352 -5.674954,10.220759 -8.795458,15.157822 -1.589163,2.224205 -4.3885,2.837623 -6.965651,2.647015 -5.69202,0.03559 -11.401026,0.160747 -17.085586,-0.143204 z"
|
|
18
|
+
id="path3" /><path
|
|
19
|
+
id="path1"
|
|
20
|
+
style="fill:#ffffff;fill-opacity:1;stroke-width:0.0306602"
|
|
21
|
+
d="m 25.115594,5.3231442 c -1.272624,0.013448 -2.494888,0.5448279 -3.472766,1.3404899 -0.382976,0.286489 -0.72504,0.7141167 -1.240273,0.735549 -1.204835,0.1106546 -2.454323,-0.092208 -3.622659,0.2994144 -1.028748,0.3634692 -1.7791,1.1960247 -2.562304,1.9153802 -0.178497,0.1508894 -0.331135,0.3479987 -0.532547,0.4625663 -1.042509,0.342932 -2.146459,0.529671 -3.126221,1.042784 -1.0055011,0.526085 -1.8289092,1.38368 -2.3056367,2.414262 -0.6169264,1.310369 -0.8189264,2.765536 -0.969047,4.192198 -0.1469094,1.761465 -0.1959037,3.529266 -0.2972177,5.2937 -0.050217,1.351994 -0.052841,2.707095 0.00817,4.058718 0.048981,0.892169 0.318118,1.792617 0.8994452,2.485755 0.6461531,0.812964 1.559796,1.409195 2.5742632,1.642407 0.814275,0.22688 1.692935,0.1991 2.488374,-0.08907 0.179483,-0.06044 0.355222,-0.131845 0.527733,-0.209885 0.946553,0.58906 2.055348,0.887688 3.163021,0.948532 0.313335,0.01181 0.628137,-5.03e-4 0.938514,-0.04617 0.0026,0.618027 0.08832,1.25628 0.422573,1.790002 0.494941,0.902705 1.309191,1.591581 2.220152,2.051555 0.868557,0.467006 1.79311,0.813601 2.703518,1.187367 0.357785,0.15693 0.765465,0.337921 1.14763,0.494026 1.033121,0.416005 2.046896,0.891399 3.116349,1.208717 0.670841,0.199433 1.381326,0.178105 2.065425,0.06592 1.20291,-0.126452 2.294245,-0.68461 3.394029,-1.146333 1.856442,-0.810222 3.750192,-1.548633 5.524949,-2.532123 0.73025,-0.44431 1.358129,-1.047752 1.888915,-1.714228 0.481558,-0.619033 0.701737,-1.397331 0.844364,-2.156627 0.07879,-0.642055 0.04526,-1.292307 0.03699,-1.937588 -0.03944,-0.921079 -0.230001,-1.829739 -0.458526,-2.72047 -0.287316,-1.051344 -0.708316,-2.060844 -0.981887,-3.1166 -0.155435,-0.558765 -0.323571,-1.201262 -0.4334,-1.773184 -0.1266,-0.791936 -0.123186,-1.598085 -0.165606,-2.397487 -0.06416,-1.386066 -0.06196,-2.782383 -0.290615,-4.154397 C 38.516982,14.291656 38.250797,13.669123 38.002776,13.046801 37.819464,12.435108 37.748115,11.795087 37.557222,11.184564 37.199846,9.9675404 36.595029,8.7929499 35.658094,7.9203835 35.015752,7.2861828 34.184737,6.8532361 33.312282,6.6356363 32.043821,6.35291 30.746056,6.6597948 29.465839,6.5853796 28.980285,6.4708321 28.546232,6.2054147 28.08907,6.0129641 27.164532,5.5603901 26.147951,5.3046847 25.115594,5.3231442 Z m 0.491695,2.3543315 c 0.90726,0.062368 1.856125,0.3863902 2.458263,1.0974879 0.150879,0.2139747 0.135362,0.5089278 0.315555,0.7116085 0.29339,0.4425223 0.984241,0.5031539 1.355273,0.1256462 0.242037,-0.2148412 0.360135,-0.5579364 0.680488,-0.6841463 0.507759,-0.2817511 1.117249,-0.3349078 1.674192,-0.1823011 0.868296,0.2072643 1.731841,0.6005346 2.333724,1.2771941 0.495907,0.615654 0.6535,1.410584 0.932961,2.132366 0.443669,1.348678 1.048637,2.66883 1.168006,4.100497 0.01727,0.183804 0.02878,0.35828 0.03227,0.516194 0.01727,0.554095 -0.0045,1.108314 -0.01666,1.662287 -0.110941,-0.393833 -0.201524,-0.826977 -0.490221,-1.133696 -0.351842,-0.357311 -1.000177,-0.323995 -1.299481,0.08318 -0.302194,0.363705 -0.163049,0.862741 -0.166381,1.292453 0.0758,1.350307 0.06026,2.712313 2.51e-4,4.048824 -0.04408,0.772705 -0.223093,1.530304 -0.357119,2.290804 -0.132814,0.683358 -0.341675,1.336802 -0.534358,2.009935 -0.207401,0.635412 -0.444957,1.335684 -1.020441,1.732088 -0.236302,0.157353 -0.50924,0.266536 -0.797584,0.24221 -0.920264,0.0073 -1.84964,0.06889 -2.76249,-0.07704 -0.462869,-0.09329 -0.939899,-0.22709 -1.316498,-0.523759 0.03676,-1.041195 0.06629,-2.083371 0.172119,-3.120621 0.172917,-1.758373 0.315942,-3.520407 0.364731,-5.287217 0.05802,-1.320592 0.08554,-2.643235 0.17658,-3.961932 0.104021,-0.417204 -0.06252,-0.912731 -0.469982,-1.098205 -0.438723,-0.226591 -1.012219,0.0018 -1.203889,0.449697 -0.326062,0.721042 -0.395887,1.52203 -0.528725,2.293622 -0.37758,2.670961 -0.538064,5.37512 -0.729104,8.05743 -0.06288,0.658196 -0.08505,1.363524 -0.281457,2.012948 -0.194736,0.58533 -0.760444,0.926535 -1.268881,1.213461 -0.532805,0.269163 -1.123089,0.536219 -1.735075,0.430506 -0.424055,-0.06795 -0.856167,-0.14435 -1.252799,-0.313794 -0.167249,-0.09676 -0.418276,-0.195058 -0.393716,-0.426873 -0.07111,-1.266087 -0.04916,-2.535606 -0.05445,-3.80325 0.02986,-3.043963 0.210333,-6.095177 -0.03814,-9.134499 -0.08957,-0.465145 -0.559771,-0.832151 -1.036437,-0.736804 -0.479111,0.07316 -0.770586,0.542942 -0.837642,0.990838 -0.315122,1.581036 -0.278071,3.20233 -0.320342,4.806401 -0.03934,2.368467 -0.01618,4.738254 -0.09776,7.105807 -0.01097,0.372897 -0.04036,0.7575 -0.239477,1.08427 -0.167123,0.377172 -0.617227,0.434011 -0.980615,0.454055 -0.696754,0.03601 -1.435379,-0.06341 -2.035972,-0.438804 -0.19933,-0.155863 -0.421816,-0.326088 -0.522041,-0.56276 -0.07751,-1.527432 -0.06843,-3.078846 -0.0684,-4.623997 0.0046,-1.609782 0.02603,-3.245763 0.06938,-4.838541 0.01167,-0.626955 0.06121,-1.25167 0.124114,-1.875064 0.04428,-0.389993 -0.03482,-0.841175 -0.382979,-1.075094 -0.434556,-0.327471 -1.128075,-0.127997 -1.32821,0.376751 -0.226328,0.599278 -0.361505,1.231002 -0.481869,1.859199 -0.155834,1.224593 -0.152109,2.462573 -0.203904,3.694283 -0.05904,1.935794 -0.09059,3.88463 -0.156593,5.808039 -0.0166,0.331835 -0.02327,0.665059 -0.06783,0.994665 -0.448571,-0.01302 -0.866056,0.0051 -1.309061,-0.06138 C 10.260037,28.535483 9.830301,28.288892 9.6752677,27.850039 9.3887966,27.078705 9.3074798,26.249465 9.2271028,25.435847 c -0.1875134,-2.171254 0.1410831,-4.337989 0.2542,-6.5037 0.085062,-1.211478 0.1369136,-2.444802 0.5337582,-3.604206 0.176918,-0.505776 0.326104,-1.056595 0.729926,-1.435294 0.478925,-0.527352 1.085586,-0.942969 1.773756,-1.141241 0.300231,-0.08847 0.615973,-0.150207 0.92982,-0.123119 0.157948,0.312997 0.325464,0.66948 0.680313,0.798202 0.456737,0.180758 1.025412,-0.08618 1.157904,-0.564167 0.251041,-0.900065 0.516838,-1.858693 1.206743,-2.531387 0.396948,-0.3875395 0.946204,-0.6191853 1.497745,-0.644313 0.699345,0.06966 1.392908,0.1903551 2.085082,0.3107858 -0.04455,0.3682202 -0.0699,0.7969362 0.221041,1.0776972 0.371743,0.416259 1.109662,0.332148 1.398326,-0.139225 0.245939,-0.354082 0.306771,-0.796642 0.525163,-1.1667665 0.272256,-0.5539997 0.58824,-1.1190889 1.117508,-1.4670274 0.657098,-0.4538157 1.472201,-0.676384 2.268898,-0.6246168 z M 37.044925,23.64154 c 0.47062,1.501038 1.005342,2.98343 1.395504,4.508739 0.03547,0.142236 0.09494,0.386879 0.121514,0.525274 0.157263,0.747778 0.243088,1.544898 -0.01606,2.281028 -0.163231,0.667682 -0.570764,1.26548 -1.137593,1.655461 -0.718807,0.510991 -1.542117,0.846762 -2.336226,1.220407 -1.388131,0.600045 -2.765079,1.225312 -4.134265,1.867478 -0.290046,0.130633 -0.606173,0.286593 -0.886131,0.391126 0.267173,-0.887687 0.286319,-1.846775 0.03332,-2.740078 -0.09277,-0.427096 -0.302454,-0.895611 -0.751193,-1.041336 -0.488967,-0.185679 -1.075725,0.166805 -1.150185,0.681929 -0.04376,0.371152 0.08842,0.738432 0.07858,1.111593 0.03565,0.798414 -0.1766,1.585994 -0.503482,2.308648 -0.843579,-0.305481 -1.664766,-0.679381 -2.413237,-1.177682 -0.117503,-0.07367 -0.243906,-0.155838 -0.372861,-0.241391 0.03068,-0.818745 0.08359,-1.641716 0.021,-2.459583 -0.06533,-0.411329 -0.276168,-0.799271 -0.576557,-1.086896 0.698757,-0.18474 1.382891,-0.42998 2.037015,-0.737787 0.736459,0.255116 1.491574,0.460537 2.253456,0.623608 0.818943,0.09219 1.646283,0.06626 2.469254,0.08076 0.666263,0.01333 1.342627,-0.03351 1.97162,-0.270384 0.720277,-0.220033 1.434931,-0.553762 1.929173,-1.141155 0.430439,-0.501755 0.744173,-1.101783 0.951971,-1.727088 0.09579,-0.484789 0.226638,-0.960894 0.352041,-1.438796 0.24224,-1.034041 0.383668,-2.089165 0.513282,-3.142377 0.01575,-0.142742 0.02757,-0.285858 0.04195,-0.42873 0.03606,0.125756 0.07201,0.251493 0.108064,0.377241 z M 21.19089,32.252314 c 0.570289,0.196888 1.133162,0.416507 1.681874,0.667539 0.01964,0.418425 -0.02826,0.837194 -0.06632,1.253549 -0.686572,-0.241633 -1.366681,-0.507582 -2.016383,-0.837009 0.04188,-0.384155 0.124628,-0.768927 0.283917,-1.122396 0.03896,0.01242 0.07794,0.02544 0.116903,0.03829 z" /></g></svg>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
3
|
+
|
|
4
|
+
<svg
|
|
5
|
+
version="1.1"
|
|
6
|
+
id="svg1"
|
|
7
|
+
width="512"
|
|
8
|
+
height="511.99997"
|
|
9
|
+
viewBox="0 0 512 511.99999"
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
xmlns:svg="http://www.w3.org/2000/svg">
|
|
12
|
+
<defs
|
|
13
|
+
id="defs1" />
|
|
14
|
+
<g
|
|
15
|
+
id="g1">
|
|
16
|
+
<path
|
|
17
|
+
id="path1"
|
|
18
|
+
style="fill:#000000;stroke-width:0.423233"
|
|
19
|
+
d="m 267.86802,29.637334 c -10.0632,0.171695 -20.05607,2.747811 -29.00402,7.340983 -6.75106,3.421997 -12.92882,7.88085 -18.65532,12.809296 -0.88209,0.733325 -1.8156,1.51642 -2.67403,2.208349 -0.66904,0.52914 -1.2731,1.01159 -1.96075,1.515208 -0.8202,0.60251 -1.66303,1.174499 -2.53197,1.704508 -0.17562,0.09905 -0.47857,0.287645 -0.70926,0.41075 -2.60488,1.506768 -5.57734,2.237595 -8.54483,2.588254 -0.4953,0.0596 -1.09737,0.1242 -1.63584,0.170608 -1.70855,0.154691 -3.4154,0.244768 -5.14773,0.298589 -9.55368,0.323178 -19.20427,-0.10573 -28.76692,0.711955 -5.97002,0.503688 -11.9659,1.694454 -17.39858,4.296641 -5.95001,2.829621 -11.12251,7.003727 -16.03297,11.339579 -7.02397,6.205421 -13.57141,12.923332 -20.61198,19.109295 -0.39654,0.276041 -0.90307,0.332441 -1.34533,0.518052 -4.96082,1.648329 -10.0502,2.998345 -15.096729,4.425539 -6.833451,1.92332 -13.685755,3.829 -20.33638,6.32817 -5.036399,1.92995 -9.796642,4.5369 -14.252662,7.56606 -5.977487,4.06976 -11.26884,9.15518 -15.50644,15.01894 -5.315134,7.322 -9.003531,15.70507 -11.663959,24.31987 -2.679199,8.7249 -4.38538,17.71571 -5.713604,26.73488 -0.793576,5.35046 -1.443947,10.72184 -1.927082,16.10925 -0.884777,9.71752 -1.371413,19.46542 -1.87227,29.20842 -0.680924,13.84298 -1.310389,27.69243 -2.086165,41.52309 -0.451344,8.45497 -0.512735,16.92425 -0.543423,25.38941 -0.01739,9.84561 0.02908,19.69561 0.472531,29.53263 0.375065,6.57122 1.276142,13.19232 3.614897,19.37837 1.991935,5.33916 5.08712,10.22688 8.843866,14.49689 2.979482,3.41844 6.29422,6.55725 9.943662,9.25325 5.358995,3.92822 11.454143,6.81598 17.840331,8.62754 4.108971,1.18729 8.31855,2.05778 12.577779,2.47318 7.367164,0.60702 14.800827,-0.7388 21.706277,-3.29098 2.960141,-1.07859 5.834541,-2.37507 8.687011,-3.7084 5.14939,3.11229 10.36284,6.20874 16.03137,8.29125 5.98239,2.26304 12.22994,3.76685 18.53377,4.80619 7.20703,1.14605 14.59994,1.31253 21.81558,0.14475 2.1928,-0.32596 4.37751,-0.7086 6.57608,-0.99818 0.10178,2.5347 0.0795,5.13603 0.1514,7.7024 0.10066,4.36786 0.29771,8.77335 1.31679,13.03872 0.64199,2.60028 1.69834,5.08098 2.98771,7.42332 4.98819,9.44879 12.6881,17.38257 21.79779,22.92878 6.06867,3.76952 12.51998,6.86947 19.00574,9.84475 6.72764,3.04348 13.60011,5.75132 20.4803,8.42688 5.34774,2.2163 10.59368,4.66723 15.93679,6.8943 5.5026,2.31303 11.03566,4.55366 16.53597,6.87252 8.30432,3.45807 16.61771,6.91953 25.13367,9.83032 4.31213,1.44402 8.75791,2.56023 13.29782,2.95573 3.65448,0.35271 7.35055,0.29984 10.98925,-0.19753 5.03285,-0.6176 10.13728,-1.17132 15.10249,-2.32613 4.99518,-1.15001 9.82641,-2.90088 14.59607,-4.75688 4.96741,-1.96457 9.87226,-4.08341 14.7794,-6.19318 8.02513,-3.47983 16.02031,-6.98802 24.0736,-10.39888 8.52796,-3.62802 17.10945,-7.15958 25.54386,-11.01385 8.3985,-3.81163 16.72509,-7.78354 24.94291,-11.97203 3.23931,-1.66679 6.47814,-3.35226 9.54871,-5.31791 4.79488,-3.13919 9.11507,-6.94126 13.22957,-10.91494 3.7694,-3.70033 7.34077,-7.63331 10.3556,-11.97965 2.27464,-3.37759 3.82366,-7.17494 5.17621,-10.99715 1.34238,-3.87964 2.39048,-7.85995 3.18325,-11.88677 0.5519,-2.94651 0.7207,-5.94687 0.76183,-8.93933 0.058,-3.77676 0.0307,-7.55429 0.0299,-11.33135 -0.0237,-5.89207 -0.22448,-11.8038 -1.14771,-17.63218 -0.71108,-4.8197 -1.5703,-9.61751 -2.55546,-14.38858 -1.91289,-9.05437 -4.52973,-17.94954 -7.59315,-26.67788 -1.33275,-3.84948 -2.69971,-7.68777 -3.94812,-11.56589 -2.40566,-7.57179 -4.6336,-15.28096 -6.64366,-22.9979 -1.33073,-5.07501 -2.58524,-10.21727 -3.63956,-15.37664 -0.12413,-0.62872 -0.26803,-1.32641 -0.38294,-1.95417 -0.46369,-2.39116 -0.78323,-4.80827 -0.96476,-7.23708 -0.51973,-6.13157 -0.81015,-12.26782 -1.09424,-18.42593 -0.74705,-16.94755 -1.00904,-33.92517 -2.43494,-50.83562 -0.59613,-6.72377 -1.43528,-13.45328 -3.10312,-20.00489 -0.9947,-3.94558 -2.33131,-7.79819 -3.89114,-11.5544 -1.40947,-3.40338 -2.88839,-6.79219 -3.88894,-10.3453 -0.88265,-3.03302 -1.35403,-6.16029 -2.02187,-9.24295 -1.86606,-9.04396 -4.09858,-18.07649 -7.79513,-26.567945 -2.38806,-5.545286 -5.15405,-10.941556 -8.45903,-15.999304 -2.84291,-4.319412 -6.17056,-8.31048 -9.82947,-11.960748 -3.48735,-3.546742 -7.25622,-6.863626 -11.52605,-9.442795 -3.40193,-2.09197 -6.98664,-3.880951 -10.66976,-5.421092 -4.41458,-1.816552 -9.05682,-3.107029 -13.80139,-3.67509 -9.231,-1.190021 -18.5671,-0.339413 -27.80273,0.124262 -3.38096,0.174078 -6.76379,0.311234 -10.14775,0.411076 -2.52913,0.04762 -5.14658,0.11553 -7.70679,-0.03147 -0.72015,-0.04289 -1.52144,-0.13883 -2.18134,-0.247933 -2.19703,-0.342257 -4.27048,-1.176154 -6.3227,-1.998367 -3.59616,-1.48657 -7.10316,-3.176899 -10.63724,-4.803041 -5.62407,-2.614834 -11.27221,-5.24623 -17.21374,-7.068924 -5.60641,-1.674657 -11.3957,-2.722306 -17.22446,-3.207975 -2.31341,-0.176216 -4.63432,-0.248447 -6.9543,-0.215571 z m 3.47184,18.519769 c 1.11398,0.01 2.24727,0.03695 3.32439,0.09994 0.46191,0.02085 0.90738,0.059 1.39781,0.09307 7.86892,0.615787 15.65018,2.635268 22.747,6.108441 2.91589,1.433448 5.70538,3.129637 8.2932,5.096101 0.43138,0.329884 0.93535,0.729466 1.38312,1.101428 0.79733,0.662771 1.56909,1.356229 2.31521,2.07613 0.31903,0.315408 0.71651,0.707741 1.05308,1.066136 1.11894,1.197638 2.21018,2.438506 3.09328,3.823367 0.90369,1.471088 1.41168,3.140135 1.76753,4.818038 0.48064,1.951827 1.39628,3.926076 3.08952,5.106859 2.01976,1.390111 4.96485,1.111086 6.73167,-0.573257 1.85891,-1.49881 2.91366,-3.695287 4.4024,-5.514434 0.1585,-0.184856 0.406,-0.477281 0.61195,-0.693369 2.44765,-2.627164 5.64265,-4.40617 8.90789,-5.816909 2.24542,-0.97651 4.65207,-1.775256 6.99618,-2.297441 0.84051,-0.188194 1.76874,-0.354848 2.56833,-0.475311 2.54305,-0.374502 5.12679,-0.455079 7.68929,-0.258734 0.42052,0.03341 0.92583,0.07786 1.37717,0.128127 0.26298,0.03177 0.66206,0.07714 0.97705,0.123498 3.2999,0.472276 6.51176,1.208107 9.72655,2.113989 6.31476,1.801954 12.41756,4.371945 18.06966,7.720897 0.55986,0.33614 1.20024,0.722238 1.78176,1.093174 3.89428,2.486111 7.58993,5.33741 10.72827,8.741904 4.02936,4.390131 6.80778,9.761594 8.98615,15.266671 1.67534,4.276832 3.01441,8.675372 4.61316,12.980262 1.79348,4.95646 3.41268,10.00999 5.1996,14.98336 2.64741,7.48016 5.42679,14.91925 7.75169,22.50907 0.40131,1.33398 0.82101,2.73484 1.18906,4.0786 1.1732,4.22644 2.14376,8.51074 2.85729,12.83916 0.55515,3.43079 0.99743,6.95391 1.27204,10.44667 0.0497,0.61436 0.0915,1.29536 0.13901,1.94696 0.0322,0.5885 0.0745,1.27522 0.10289,1.90273 0.3682,8.65505 0.003,17.31692 -0.18446,25.97166 -0.073,2.61755 -0.17851,5.28145 -0.31902,7.89025 -0.27534,5.2083 -0.81705,10.45846 -1.11702,15.69153 -0.33958,6.05535 -0.0303,12.15371 1.04647,18.12551 1.27765,7.18658 3.47973,14.17079 5.36719,21.19839 1.09338,4.00648 2.2912,7.98392 3.57854,11.93257 2.55734,7.8948 5.2302,15.75284 7.76048,23.65709 2.22967,6.90555 4.40263,13.8508 6.42039,20.79518 1.55158,5.32574 2.99874,10.65523 4.25211,16.0577 0.43562,1.88476 0.86461,3.88497 1.23499,5.79467 0.42234,2.20073 0.79711,4.44241 1.07979,6.63488 0.35192,2.69512 0.57784,5.4073 0.65279,8.12456 0.0148,0.68443 0.03,1.45893 0.0245,2.17931 0,0.84555 -0.0229,1.6909 -0.0561,2.53577 -0.0241,0.43168 -0.0462,0.97815 -0.0843,1.45322 -0.10407,1.38682 -0.29203,2.76649 -0.54394,4.13396 -0.0523,0.25904 -0.11076,0.58564 -0.17188,0.87319 -0.62777,2.98178 -1.4467,5.92112 -2.34835,8.83074 -1.25421,4.01918 -2.93432,7.89437 -5.20831,11.4482 -1.99203,3.12243 -4.37994,5.99301 -7.09702,8.51058 -0.53274,0.49046 -1.13757,1.03705 -1.715,1.53032 -1.72458,1.4818 -3.53983,2.85604 -5.41218,4.14531 -0.59517,0.40417 -1.26579,0.85631 -1.90179,1.26235 -4.19266,2.71399 -8.66345,4.95768 -13.12637,7.18539 -9.50904,4.70254 -19.19765,9.03099 -28.95009,13.20164 -13.12253,5.6691 -26.08501,11.6948 -39.03249,17.74913 -7.23175,3.3613 -14.45988,6.71644 -21.82309,9.76481 -0.95834,0.39324 -1.85522,0.75442 -2.82713,1.12273 -2.0524,0.78335 -4.18729,1.51171 -6.27398,2.07999 -1.13936,0.30997 -2.28949,0.58135 -3.44951,0.80182 2.11797,-2.58646 3.67005,-5.57915 4.96486,-8.64639 1.99472,-4.78429 3.23883,-9.85659 3.98782,-14.9773 0.85894,-6.0763 0.83912,-12.29987 -0.32438,-18.33497 -0.59042,-3.2403 -1.33062,-6.46007 -2.34454,-9.59549 -0.63761,-1.92865 -1.51146,-3.91135 -3.17305,-5.17473 -1.39518,-1.09026 -3.3234,-1.567 -5.02702,-0.98222 -2.14611,0.70531 -3.70696,2.90992 -3.58253,5.17808 0.0343,1.48365 0.38657,2.93435 0.54444,4.40605 0.19701,1.43081 0.35246,2.85233 0.47531,4.27032 0.22958,2.64729 0.32911,5.36767 0.27649,8.05301 -0.0457,2.489 -0.23674,5.01603 -0.56374,7.52223 -0.0835,0.62575 -0.16617,1.18484 -0.26204,1.80867 -0.10212,0.64245 -0.22804,1.37575 -0.35677,2.05065 -1.10278,5.94005 -3.04111,11.69319 -5.3792,17.25358 -0.62901,1.517 -1.33684,3.0725 -1.95176,4.62323 -0.40427,1.08194 -0.87228,2.20364 -0.74387,3.38433 -1.55822,-0.0592 -3.08519,-0.43771 -4.53391,-1.00217 -3.03739,-1.09948 -6.04309,-2.28349 -9.05321,-3.45485 -6.58578,-2.59006 -13.07539,-5.47076 -19.21083,-9.01186 -4.56753,-2.60117 -8.95578,-5.37144 -13.35437,-8.26431 -1.3671,-0.90269 -2.73179,-1.80917 -4.09011,-2.72508 0.48509,-9.19203 0.85581,-18.39314 0.8546,-27.59943 -0.004,-2.74256 -0.009,-5.48958 -0.20735,-8.2258 -0.20993,-2.05668 -0.82723,-4.06502 -1.79486,-5.89094 -1.33542,-2.81156 -3.28932,-5.38369 -5.88348,-7.14296 -3.14105,-2.2696 -6.75724,-3.73473 -10.30424,-5.23524 -3.23924,-1.33237 -6.51191,-2.58217 -9.79377,-3.80512 6.01384,0.0457 12.03341,0.0282 18.03873,-0.3245 1.83606,-0.117 3.67763,-0.26952 5.47122,-0.69967 2.44509,-0.57495 4.85838,-1.27901 7.26105,-2.00919 5.26181,-1.63106 10.43746,-3.53371 15.5346,-5.62091 2.73825,-1.15148 5.43558,-2.39996 8.0832,-3.7468 3.10623,1.25504 6.26979,2.36916 9.49004,3.29466 7.02226,2.12718 14.11449,4.02382 21.2559,5.70666 3.60134,0.76972 7.29915,0.83938 10.96442,0.99547 6.43307,0.20509 12.87039,0.2678 19.30633,0.33821 4.54478,0.0279 9.09369,0.0772 13.63459,-0.14356 3.68455,-0.19141 7.36825,-0.67321 10.92145,-1.69089 3.08185,-0.85432 6.10836,-1.89431 9.12796,-2.94425 4.1011,-1.45303 8.14385,-3.17184 11.77409,-5.59722 4.79143,-3.17226 8.76643,-7.47793 11.861,-12.3 2.60516,-4.04303 4.72244,-8.38263 6.56004,-12.82155 1.60684,-3.87538 1.78141,-8.136 2.99232,-12.12497 1.80809,-6.54703 3.5948,-13.11064 4.78021,-19.80476 1.94233,-11.11294 3.72442,-22.26087 4.92962,-33.48074 0.50862,-4.83712 0.96186,-9.68349 1.1881,-14.54296 0.26774,-5.76845 0.18264,-11.54984 -0.17218,-17.31262 -0.79319,-13.54819 -2.91561,-27.02238 -6.38636,-40.14372 -0.88475,-2.96343 -1.79192,-5.95279 -3.26167,-8.68749 -1.06413,-1.78414 -3.16666,-3.00735 -5.26928,-2.71979 -2.41007,0.25968 -4.49161,2.42608 -4.52563,4.87305 -0.11713,1.33773 0.01,2.69641 0.0274,4.00711 0.20632,5.51229 0.5864,11.05188 0.77431,16.54277 0.3863,12.31359 0.2895,24.63823 -0.10723,36.95023 -0.14307,4.12021 -0.26421,8.26351 -0.52018,12.38705 -0.23035,2.8368 -0.67393,5.65129 -1.1097,8.46238 -1.4207,8.76923 -3.05775,17.49253 -4.80895,26.20639 -0.93967,3.63864 -1.95881,7.25601 -2.9445,10.88232 -1.48593,5.37898 -2.98537,10.758 -4.74612,16.05472 -0.61072,1.79454 -1.28262,3.60277 -1.98852,5.30751 -1.97581,4.74942 -4.33848,9.41414 -7.69109,13.35201 -2.39384,2.8305 -5.34122,5.18242 -8.62285,6.90527 -1.86769,0.97424 -3.80698,1.8327 -5.82705,2.43797 -1.52724,0.42214 -3.12761,0.41968 -4.69893,0.49838 -3.98888,0.13728 -7.98043,0.18474 -11.97122,0.23688 -5.08159,0.0524 -10.16482,0.0841 -15.24521,-0.0637 -0.83791,-0.0295 -1.76017,-0.0647 -2.63063,-0.10761 -3.46096,-0.16737 -6.94614,-0.44653 -10.38488,-1.03859 -0.81823,-0.13528 -1.63447,-0.28937 -2.41529,-0.44836 -4.00449,-0.81925 -8.00211,-2.02801 -11.78699,-3.64841 -1.39163,-0.60763 -2.82676,-1.30087 -4.10726,-2.0297 -2.46558,-1.42665 -4.85662,-3.14912 -6.48076,-5.53014 -0.0972,-1.54456 0.0315,-3.09851 0.11636,-4.64318 0.17385,-2.75305 0.18496,-5.51316 0.28067,-8.26954 0.11331,-4.28913 0.23966,-8.57559 0.48166,-12.86814 0.59109,-10.59901 1.58515,-21.23452 2.60151,-31.82538 1.6329,-16.92322 2.92614,-33.88483 3.55576,-50.87761 0.66948,-16.72754 1.24996,-33.45867 1.96822,-50.18422 0.21533,-4.66445 0.43531,-9.33226 0.75333,-13.97396 0.0699,-1.61691 0.55151,-3.19951 0.48416,-4.82355 -0.0642,-1.62421 -0.76175,-3.27521 -2.10293,-4.24728 -1.80565,-1.37075 -4.56073,-1.41336 -6.31075,0.078 -1.47463,1.11655 -2.17773,2.89709 -2.82588,4.56518 -2.09667,5.48332 -3.02798,11.30727 -4.07949,17.05588 -2.00329,11.51327 -3.42447,23.11852 -4.68989,34.73335 -1.64016,15.29647 -2.935,30.62802 -4.10789,45.96706 -0.85662,11.28143 -1.62529,22.56857 -2.38379,33.85707 -0.30699,4.36198 -0.6315,8.79173 -1.00435,13.13511 -0.31716,3.49056 -0.651,6.96699 -1.10465,10.45705 -0.5633,4.19193 -1.21282,8.43037 -2.5926,12.4612 -1.19278,3.48141 -2.99915,6.78746 -5.53669,9.47333 -2.05057,2.20756 -4.39595,4.19093 -6.80594,5.94494 -1.24686,0.9073 -2.54507,1.7868 -3.82665,2.58362 -3.23594,2.02601 -6.62664,3.8025 -10.12353,5.33382 -1.13508,0.48965 -2.37775,1.0068 -3.58432,1.4547 -2.41812,0.90815 -4.8433,1.6766 -7.36013,2.2697 -1.62702,0.39447 -3.29541,0.5936 -4.96648,0.66416 -0.43149,0.0189 -0.97615,0.0316 -1.45221,0.0301 -5.46861,-0.0214 -10.84531,-1.20715 -16.12929,-2.51189 -1.43114,-0.35502 -2.82638,-0.68844 -4.24312,-1.11738 -0.19493,-0.0603 -0.53409,-0.16826 -0.78447,-0.24716 -0.75613,-0.25567 -1.46965,-0.51266 -2.18071,-0.82415 -3.31482,-1.42348 -6.46343,-3.39052 -8.87461,-6.10382 -0.72183,-0.82996 -1.34385,-1.8084 -1.45102,-2.92867 -0.12378,-0.72314 -0.22453,-1.53585 -0.29565,-2.21048 -0.30237,-3.14811 -0.42438,-6.30989 -0.52573,-9.46985 -0.0177,-0.84226 -0.0401,-1.77064 -0.0595,-2.64603 -0.27871,-12.92179 -0.27973,-25.84732 -0.29636,-38.77149 0.0214,-9.3648 0.26753,-18.72707 0.45891,-28.08944 0.69922,-31.68503 1.64071,-63.42842 -0.47663,-95.08141 -0.12553,-1.57608 -0.16815,-3.16266 -0.38689,-4.72896 -0.401,-1.61476 -1.3434,-3.16885 -2.79566,-4.03478 -1.47394,-0.87133 -3.37269,-0.941 -4.90608,-0.17916 -1.70986,0.80772 -2.83243,2.46963 -3.51981,4.17674 -0.67383,1.72361 -0.99637,3.55628 -1.37862,5.35974 -0.91168,4.71347 -1.48423,9.4846 -1.99857,14.25538 -1.03654,10.19214 -1.28836,20.44113 -1.5697,30.67572 -0.59703,26.28457 -0.63029,52.57716 -0.90646,78.86602 -0.10752,10.15952 -0.21894,20.31973 -0.49209,30.47638 -0.12085,4.13631 -0.28635,8.31239 -0.60533,12.45495 -0.22029,2.41139 -0.45553,4.85872 -1.31794,7.14128 -1.28335,3.48538 -2.81744,6.98289 -5.35569,9.752 -2.14949,2.35086 -5.09774,3.83655 -8.15448,4.62095 -0.87789,0.23936 -1.80377,0.43833 -2.65736,0.58895 -2.10491,0.37707 -4.26609,0.5661 -6.36988,0.68019 -6.7877,0.35503 -13.68075,-0.37364 -20.2372,-2.24073 -4.24462,-1.245 -8.45186,-2.88128 -12.04134,-5.51617 -2.88597,-2.15376 -5.52227,-4.67815 -7.62831,-7.60748 -0.85769,-1.25362 -1.71373,-2.60799 -1.85889,-4.15717 -0.0648,-0.45076 -0.11702,-1.04362 -0.14998,-1.55718 -0.0555,-0.82085 -0.0802,-1.75791 -0.13026,-2.6296 -0.49884,-11.54822 -0.64945,-23.1161 -0.73664,-34.68057 -0.15233,-26.65888 0.0434,-53.31988 0.59179,-79.97356 0.10135,-4.44319 0.2159,-8.88607 0.3447,-13.32855 0.15443,-4.37873 0.30058,-8.83417 0.56221,-13.20649 0.11603,-2.3509 0.35455,-4.69265 0.62871,-7.02968 0.37002,-3.3391 0.75624,-6.70063 0.56319,-10.06469 -0.17089,-1.79884 -1.00385,-3.62545 -2.56585,-4.62168 -1.90486,-1.26365 -4.60648,-1.0381 -6.32633,0.44732 -1.27586,1.07379 -1.83119,2.71354 -2.35147,4.24185 -1.95796,6.37919 -3.55022,12.86858 -4.878416,19.40716 -1.096203,5.84632 -1.424178,11.79763 -1.783914,17.72428 -0.605761,10.97476 -0.945966,21.96334 -1.288598,32.94854 -0.723201,24.0641 -1.204615,48.13459 -1.867075,72.20031 -0.145489,4.87882 -0.316963,9.75967 -0.567063,14.64205 -0.119321,2.11121 -0.228871,4.27345 -0.413314,6.39976 -0.04862,0.49693 -0.100779,1.10151 -0.162755,1.63918 -0.210967,1.68581 -0.374751,3.41031 -1.001966,5.0036 -0.367966,0.9066 -1.037866,1.72494 -1.977294,2.06905 -1.42387,0.56737 -2.985505,0.40305 -4.48247,0.44159 -3.073132,3.8e-4 -6.144509,-0.1185 -9.216406,-0.19112 -2.692791,-0.0927 -5.442018,-0.15349 -8.138975,-0.4778 -0.32311,-0.0427 -0.577503,-0.08 -0.918658,-0.14339 -1.837027,-0.3151 -3.579901,-1.00537 -5.258152,-1.79738 -2.790418,-1.29703 -5.577168,-2.70071 -7.927927,-4.71623 -1.956605,-1.62856 -3.613621,-3.61235 -4.854949,-5.83584 -2.119716,-3.68721 -3.344174,-7.80172 -4.349108,-11.91023 -1.002897,-4.21121 -1.745174,-8.49067 -2.38895,-12.74029 -1.021898,-6.91444 -1.699315,-13.96153 -2.072545,-20.93686 -0.125706,-2.31381 -0.21936,-4.62311 -0.276592,-6.92152 -0.204771,-7.90922 -0.0015,-15.79103 0.423821,-23.6843 0.714116,-13.27516 1.993908,-26.56597 2.933902,-39.85139 0.877049,-12.31079 1.475911,-24.62641 2.751398,-36.89698 0.618897,-6.04426 1.502482,-12.10305 3.003197,-18.01391 0.530476,-2.15655 1.124718,-4.34985 1.730786,-6.45287 1.400531,-4.73806 2.97872,-9.43048 4.893056,-13.98742 1.318267,-3.04547 2.673023,-6.15491 4.882041,-8.67722 1.934583,-2.33968 4.027827,-4.54542 6.225936,-6.63848 0.71815,-0.67837 1.522323,-1.42081 2.263405,-2.07884 2.425702,-2.17062 4.972586,-4.22653 7.778136,-5.88995 5.485082,-3.32948 11.469544,-5.87551 17.727322,-7.32406 0.472305,-0.10814 0.872087,-0.19083 1.349928,-0.28909 0.554219,-0.11143 1.207635,-0.23127 1.803606,-0.32536 0.728175,-0.11878 1.47874,-0.22318 2.172383,-0.29848 0.51934,-0.0615 1.06489,-0.10941 1.62239,-0.15166 2.13238,-0.13085 4.31566,-0.24035 6.40572,0.28958 1.15124,0.28344 2.20547,0.91682 2.97952,1.81706 1.66155,1.84132 2.40912,4.25798 3.64692,6.36476 0.86467,1.44589 2.14556,2.79578 3.8443,3.18008 2.12889,0.52151 4.60616,-0.3809 5.70094,-2.32633 0.77244,-1.31288 1.00526,-2.84269 1.45786,-4.27733 1.16266,-4.17917 2.32168,-8.34161 3.84934,-12.39419 2.36542,-6.29582 5.35185,-12.426925 9.51561,-17.741882 3.46176,-4.428571 7.73769,-8.283887 12.72687,-10.914574 0.17027,-0.08871 0.43756,-0.229082 0.62585,-0.321314 1.4556,-0.73656 3.04694,-1.40932 4.62285,-1.966526 1.55697,-0.554076 3.22895,-1.039994 4.87175,-1.426158 1.83003,-0.407909 3.67146,-0.831601 5.55076,-0.919249 0.18469,-0.0078 0.51816,-0.0164 0.76429,-0.01158 1.67206,0.06341 3.336,0.270405 4.99807,0.457311 5.02307,0.637575 10.02935,1.40122 15.0298,2.195345 4.66066,0.753485 9.34929,1.557944 14.00245,2.433893 0.89574,0.174612 1.79089,0.352814 2.68138,0.552712 -0.10793,2.491153 -0.35158,4.97284 -0.59282,7.45371 -0.14478,1.668645 -0.28679,3.346522 -0.21439,5.021838 0.17502,2.053016 1.60523,3.986264 3.59935,4.596284 2.20724,0.734244 4.81136,-0.137381 6.16329,-2.023459 1.61378,-2.003709 2.40286,-4.497595 3.23171,-6.893431 0.55471,-1.721247 1.28286,-3.434712 2.05797,-5.098769 0.32522,-0.706805 0.63426,-1.389774 0.96228,-2.06718 0.47097,-0.989051 0.95332,-1.968394 1.43984,-2.919793 1.55336,-3.037731 3.19176,-6.035529 4.98862,-8.93667 0.36331,-0.580118 0.7465,-1.161354 1.1113,-1.693505 0.43698,-0.638715 0.8834,-1.239037 1.34102,-1.831646 2.62567,-3.387442 5.77948,-6.353068 9.26296,-8.84471 0.19801,-0.135975 0.4785,-0.340324 0.68204,-0.478251 5.97372,-4.113188 12.81528,-6.882403 19.87876,-8.456601 2.67881,-0.591943 5.45428,-0.960935 8.1612,-1.131821 1.25852,-0.07823 2.51944,-0.108522 3.78017,-0.119034 z m -74.1948,328.447317 c -2.32148,2.4429 -3.81101,5.53362 -4.94977,8.67159 -1.29635,3.65472 -2.2049,7.43383 -3.0024,11.22451 -0.18915,-0.88005 -0.32449,-1.86772 -0.39678,-2.7039 -0.37984,-4.42809 0.59907,-9.02264 3.06337,-12.75233 0.83249,-1.24926 1.78517,-2.44411 2.95458,-3.39405 0.73152,-0.55232 1.57922,-0.9428 2.46242,-1.18139 -0.0438,0.0452 -0.0876,0.0904 -0.13142,0.13557 z m 12.79454,9.56078 c 1.9961,0.37731 3.90492,1.095 5.83327,1.71616 6.37089,2.16138 12.63723,4.62182 18.83558,7.23409 1.57886,0.674 3.13885,1.35807 4.67721,2.07573 1.08555,0.52289 2.19204,1.01358 3.23627,1.61436 0.52436,0.32185 0.55155,0.98729 0.7159,1.51731 0.50576,2.47572 0.54785,5.017 0.45877,7.53389 -0.0596,1.68974 -0.14569,3.49471 -0.26347,5.18519 -0.35335,5.22726 -0.87256,10.44651 -1.66175,15.62681 -0.0643,0.36657 -0.14324,0.85485 -0.21603,1.26783 0.0251,0.37826 -0.39366,0.0467 -0.60746,0.0429 -1.88917,-0.55887 -3.75938,-1.19118 -5.60829,-1.8046 -4.12039,-1.38672 -8.19698,-2.90084 -12.24505,-4.48567 -4.09366,-1.61561 -8.21002,-3.31849 -12.23238,-5.15412 -2.5006,-1.14165 -5.04659,-2.34323 -7.49042,-3.66207 -0.85902,-0.46498 -1.69057,-0.94123 -2.51348,-1.49517 -0.085,-2.99651 0.23654,-5.99203 0.72661,-8.94478 0.39528,-2.28622 0.91134,-4.55125 1.54083,-6.7843 0.10087,-0.33697 0.23244,-0.79548 0.34635,-1.17877 0.78014,-2.52785 1.69953,-5.03993 3.06392,-7.31662 0.79392,-1.25841 1.83587,-2.50182 3.29863,-2.97158 0.035,-0.005 0.07,-0.0113 0.10499,-0.0166 z" />
|
|
20
|
+
</g>
|
|
21
|
+
</svg>
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
<html lang="en" theme="auto">
|
|
2
|
+
<head>
|
|
3
|
+
<meta charset='utf-8'>
|
|
4
|
+
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
|
|
5
|
+
<title>Middleware - Kempo Server</title>
|
|
6
|
+
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
|
7
|
+
<link rel="icon" type="image/png" sizes="48x48" href="media/icon48.png">
|
|
8
|
+
<link rel="manifest" href="manifest.json">
|
|
9
|
+
<link rel="stylesheet" href="essential.css" />
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<main>
|
|
13
|
+
<a href="./" class="btn">Home</a>
|
|
14
|
+
<h1>Middleware</h1>
|
|
15
|
+
<p>Kempo Server includes a powerful middleware system that allows you to add functionality like authentication, logging, CORS, compression, and more.</p>
|
|
16
|
+
|
|
17
|
+
<h2>How Middleware Works</h2>
|
|
18
|
+
<p>Middleware functions run before your route handlers and can:</p>
|
|
19
|
+
<ul>
|
|
20
|
+
<li>Modify request and response objects</li>
|
|
21
|
+
<li>Add new properties to requests (authentication, user data, etc.)</li>
|
|
22
|
+
<li>Handle requests entirely (authentication checks, rate limiting)</li>
|
|
23
|
+
<li>Log requests and responses</li>
|
|
24
|
+
<li>Add security headers</li>
|
|
25
|
+
<li>Compress responses</li>
|
|
26
|
+
</ul>
|
|
27
|
+
|
|
28
|
+
<h2>Built-in Middleware</h2>
|
|
29
|
+
<p>Kempo Server includes several built-in middleware options that you can enable and configure:</p>
|
|
30
|
+
|
|
31
|
+
<h3>CORS (Cross-Origin Resource Sharing)</h3>
|
|
32
|
+
<p>Enable Cross-Origin Resource Sharing to allow requests from different domains:</p>
|
|
33
|
+
<pre><code class="hljs json">{<br /> <span class="hljs-attr">"middleware"</span>: {<br /> <span class="hljs-attr">"cors"</span>: {<br /> <span class="hljs-attr">"enabled"</span>: <span class="hljs-literal">true</span>,<br /> <span class="hljs-attr">"origin"</span>: <span class="hljs-string">"*"</span>,<br /> <span class="hljs-attr">"methods"</span>: [<span class="hljs-string">"GET"</span>, <span class="hljs-string">"POST"</span>, <span class="hljs-string">"PUT"</span>, <span class="hljs-string">"DELETE"</span>],<br /> <span class="hljs-attr">"headers"</span>: [<span class="hljs-string">"Content-Type"</span>, <span class="hljs-string">"Authorization"</span>],<br /> <span class="hljs-attr">"credentials"</span>: <span class="hljs-literal">true</span><br /> }<br /> }<br />}</code></pre>
|
|
34
|
+
|
|
35
|
+
<h4>CORS Configuration Options</h4>
|
|
36
|
+
<ul>
|
|
37
|
+
<li><code>origin</code> - Allowed origins (<code>"*"</code> for all, or specific domains)</li>
|
|
38
|
+
<li><code>methods</code> - Allowed HTTP methods</li>
|
|
39
|
+
<li><code>headers</code> - Allowed request headers</li>
|
|
40
|
+
<li><code>credentials</code> - Allow credentials (cookies, authorization headers)</li>
|
|
41
|
+
<li><code>maxAge</code> - How long browsers can cache preflight responses</li>
|
|
42
|
+
</ul>
|
|
43
|
+
|
|
44
|
+
<h3>Compression</h3>
|
|
45
|
+
<p>Automatically compress responses with gzip to reduce bandwidth:</p>
|
|
46
|
+
<pre><code class="hljs json">{<br /> <span class="hljs-attr">"middleware"</span>: {<br /> <span class="hljs-attr">"compression"</span>: {<br /> <span class="hljs-attr">"enabled"</span>: <span class="hljs-literal">true</span>,<br /> <span class="hljs-attr">"threshold"</span>: <span class="hljs-number">1024</span>,<br /> <span class="hljs-attr">"level"</span>: <span class="hljs-number">6</span><br /> }<br /> }<br />}</code></pre>
|
|
47
|
+
|
|
48
|
+
<h4>Compression Configuration Options</h4>
|
|
49
|
+
<ul>
|
|
50
|
+
<li><code>threshold</code> - Minimum size in bytes before compression is applied</li>
|
|
51
|
+
<li><code>level</code> - Compression level (1-9, where 9 is best compression)</li>
|
|
52
|
+
<li><code>filter</code> - Function to determine which responses to compress</li>
|
|
53
|
+
</ul>
|
|
54
|
+
|
|
55
|
+
<h3>Rate Limiting</h3>
|
|
56
|
+
<p>Limit the number of requests per client to prevent abuse:</p>
|
|
57
|
+
<pre><code class="hljs json">{<br /> <span class="hljs-attr">"middleware"</span>: {<br /> <span class="hljs-attr">"rateLimit"</span>: {<br /> <span class="hljs-attr">"enabled"</span>: <span class="hljs-literal">true</span>,<br /> <span class="hljs-attr">"maxRequests"</span>: <span class="hljs-number">100</span>,<br /> <span class="hljs-attr">"windowMs"</span>: <span class="hljs-number">60000</span>,<br /> <span class="hljs-attr">"message"</span>: <span class="hljs-string">"Too many requests, please try again later."</span><br /> }<br /> }<br />}</code></pre>
|
|
58
|
+
|
|
59
|
+
<h4>Rate Limiting Configuration Options</h4>
|
|
60
|
+
<ul>
|
|
61
|
+
<li><code>maxRequests</code> - Maximum number of requests per window</li>
|
|
62
|
+
<li><code>windowMs</code> - Time window in milliseconds</li>
|
|
63
|
+
<li><code>message</code> - Error message to send when limit is exceeded</li>
|
|
64
|
+
<li><code>statusCode</code> - HTTP status code to return (default: 429)</li>
|
|
65
|
+
</ul>
|
|
66
|
+
|
|
67
|
+
<h3>Security Headers</h3>
|
|
68
|
+
<p>Add security headers to responses to protect against common attacks:</p>
|
|
69
|
+
<pre><code class="hljs json">{<br /> <span class="hljs-attr">"middleware"</span>: {<br /> <span class="hljs-attr">"security"</span>: {<br /> <span class="hljs-attr">"enabled"</span>: <span class="hljs-literal">true</span>,<br /> <span class="hljs-attr">"headers"</span>: {<br /> <span class="hljs-attr">"X-Content-Type-Options"</span>: <span class="hljs-string">"nosniff"</span>,<br /> <span class="hljs-attr">"X-Frame-Options"</span>: <span class="hljs-string">"DENY"</span>,<br /> <span class="hljs-attr">"X-XSS-Protection"</span>: <span class="hljs-string">"1; mode=block"</span>,<br /> <span class="hljs-attr">"Strict-Transport-Security"</span>: <span class="hljs-string">"max-age=31536000; includeSubDomains"</span>,<br /> <span class="hljs-attr">"Referrer-Policy"</span>: <span class="hljs-string">"strict-origin-when-cross-origin"</span><br /> }<br /> }<br /> }<br />}</code></pre>
|
|
70
|
+
|
|
71
|
+
<h4>Common Security Headers</h4>
|
|
72
|
+
<ul>
|
|
73
|
+
<li><code>X-Content-Type-Options</code> - Prevents MIME type sniffing</li>
|
|
74
|
+
<li><code>X-Frame-Options</code> - Prevents clickjacking attacks</li>
|
|
75
|
+
<li><code>X-XSS-Protection</code> - Enables XSS filtering</li>
|
|
76
|
+
<li><code>Strict-Transport-Security</code> - Enforces HTTPS connections</li>
|
|
77
|
+
<li><code>Content-Security-Policy</code> - Controls resource loading</li>
|
|
78
|
+
<li><code>Referrer-Policy</code> - Controls referrer information</li>
|
|
79
|
+
</ul>
|
|
80
|
+
|
|
81
|
+
<h2>Custom Middleware</h2>
|
|
82
|
+
<p>Create your own middleware by writing JavaScript files and referencing them in your config:</p>
|
|
83
|
+
<pre><code class="hljs json">{<br /> <span class="hljs-attr">"middleware"</span>: {<br /> <span class="hljs-attr">"custom"</span>: [<br /> <span class="hljs-string">"./middleware/auth.js"</span>,<br /> <span class="hljs-string">"./middleware/logging.js"</span>,<br /> <span class="hljs-string">"./middleware/analytics.js"</span><br /> ]<br /> }<br />}</code></pre>
|
|
84
|
+
|
|
85
|
+
<h3>Custom Middleware Structure</h3>
|
|
86
|
+
<p>A custom middleware file must export a default function that returns a middleware function:</p>
|
|
87
|
+
<pre><code class="hljs javascript"><span class="hljs-comment">// middleware/example.js</span><br /><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-function">(<span class="hljs-params">config</span>) =></span> {<br /> <span class="hljs-keyword">return</span> <span class="hljs-keyword">async</span> <span class="hljs-function">(<span class="hljs-params">req, res, next</span>) =></span> {<br /> <span class="hljs-comment">// Your middleware logic here</span><br /> <span class="hljs-keyword">await</span> <span class="hljs-title function_">next</span>();<br /> };<br />};</code></pre>
|
|
88
|
+
|
|
89
|
+
<h3>Middleware Function Parameters</h3>
|
|
90
|
+
<ul>
|
|
91
|
+
<li><code>config</code> - Configuration object (can be used for middleware settings)</li>
|
|
92
|
+
<li><code>req</code> - Request object (can be modified)</li>
|
|
93
|
+
<li><code>res</code> - Response object (can be modified)</li>
|
|
94
|
+
<li><code>next</code> - Function to call the next middleware or route handler</li>
|
|
95
|
+
</ul>
|
|
96
|
+
|
|
97
|
+
<h2>Middleware Examples</h2>
|
|
98
|
+
|
|
99
|
+
<h3>Authentication Middleware</h3>
|
|
100
|
+
<pre><code class="hljs javascript"><span class="hljs-comment">// middleware/auth.js</span><br /><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-function">(<span class="hljs-params">config</span>) =></span> {<br /> <span class="hljs-keyword">return</span> <span class="hljs-keyword">async</span> <span class="hljs-function">(<span class="hljs-params">req, res, next</span>) =></span> {<br /> <span class="hljs-keyword">const</span> token = req.<span class="hljs-property">headers</span>.<span class="hljs-property">authorization</span>;<br /> <br /> <span class="hljs-keyword">if</span> (token) {<br /> <span class="hljs-keyword">try</span> {<br /> <span class="hljs-keyword">const</span> user = <span class="hljs-keyword">await</span> <span class="hljs-title function_">verifyToken</span>(token.<span class="hljs-title function_">replace</span>(<span class="hljs-string">'Bearer '</span>, <span class="hljs-string">''</span>));<br /> req.<span class="hljs-property">user</span> = user;<br /> req.<span class="hljs-property">permissions</span> = <span class="hljs-keyword">await</span> <span class="hljs-title function_">getUserPermissions</span>(user.<span class="hljs-property">id</span>);<br /> req.<span class="hljs-property">hasPermission</span> = <span class="hljs-function">(<span class="hljs-params">permission</span>) =></span> req.<span class="hljs-property">permissions</span>.<span class="hljs-title function_">includes</span>(permission);<br /> } <span class="hljs-keyword">catch</span> (error) {<br /> <span class="hljs-comment">// Token is invalid, but don't block the request</span><br /> req.<span class="hljs-property">user</span> = <span class="hljs-literal">null</span>;<br /> }<br /> } <span class="hljs-keyword">else</span> {<br /> req.<span class="hljs-property">user</span> = <span class="hljs-literal">null</span>;<br /> }<br /> <br /> <span class="hljs-keyword">await</span> <span class="hljs-title function_">next</span>();<br /> };<br />};<br /><br /><span class="hljs-comment">// Helper functions (you would implement these)</span><br /><span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">verifyToken</span>(<span class="hljs-params">token</span>) </span>{<br /> <span class="hljs-comment">// Verify JWT token or session token</span><br /> <span class="hljs-comment">// Return user object if valid, throw error if invalid</span><br />}<br /><br /><span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getUserPermissions</span>(<span class="hljs-params">userId</span>) </span>{<br /> <span class="hljs-comment">// Fetch user permissions from database</span><br /> <span class="hljs-comment">// Return array of permission strings</span><br />}</code></pre>
|
|
101
|
+
|
|
102
|
+
<h3>Logging Middleware</h3>
|
|
103
|
+
<pre><code class="hljs javascript"><span class="hljs-comment">// middleware/logging.js</span><br /><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-function">(<span class="hljs-params">config</span>) =></span> {<br /> <span class="hljs-keyword">return</span> <span class="hljs-keyword">async</span> <span class="hljs-function">(<span class="hljs-params">req, res, next</span>) =></span> {<br /> <span class="hljs-keyword">const</span> startTime = <span class="hljs-built_in">Date</span>.<span class="hljs-title function_">now</span>();<br /> <span class="hljs-keyword">const</span> { method, path, headers } = req;<br /> <br /> <span class="hljs-comment">// Log request</span><br /> <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`[${new Date().toISOString()}] ${method} ${path}`</span>);<br /> <br /> <span class="hljs-comment">// Store original response methods</span><br /> <span class="hljs-keyword">const</span> originalSend = res.<span class="hljs-property">send</span>;<br /> <span class="hljs-keyword">const</span> originalJson = res.<span class="hljs-property">json</span>;<br /> <span class="hljs-keyword">const</span> originalHtml = res.<span class="hljs-property">html</span>;<br /> <br /> <span class="hljs-comment">// Override response methods to log response</span><br /> res.<span class="hljs-property">send</span> = <span class="hljs-keyword">function</span>(<span class="hljs-params">data</span>) {<br /> <span class="hljs-keyword">const</span> duration = <span class="hljs-built_in">Date</span>.<span class="hljs-title function_">now</span>() - startTime;<br /> <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`[${new Date().toISOString()}] ${method} ${path} - ${res.statusCode || 200} - ${duration}ms`</span>);<br /> <span class="hljs-keyword">return</span> <span class="hljs-title function_">originalSend</span>.<span class="hljs-title function_">call</span>(<span class="hljs-variable language_">this</span>, data);<br /> };<br /> <br /> res.<span class="hljs-property">json</span> = <span class="hljs-keyword">function</span>(<span class="hljs-params">data</span>) {<br /> <span class="hljs-keyword">const</span> duration = <span class="hljs-built_in">Date</span>.<span class="hljs-title function_">now</span>() - startTime;<br /> <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`[${new Date().toISOString()}] ${method} ${path} - ${res.statusCode || 200} - ${duration}ms`</span>);<br /> <span class="hljs-keyword">return</span> <span class="hljs-title function_">originalJson</span>.<span class="hljs-title function_">call</span>(<span class="hljs-variable language_">this</span>, data);<br /> };<br /> <br /> <span class="hljs-keyword">await</span> <span class="hljs-title function_">next</span>();<br /> };<br />};</code></pre>
|
|
104
|
+
|
|
105
|
+
<h3>Analytics Middleware</h3>
|
|
106
|
+
<pre><code class="hljs javascript"><span class="hljs-comment">// middleware/analytics.js</span><br /><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-function">(<span class="hljs-params">config</span>) =></span> {<br /> <span class="hljs-keyword">return</span> <span class="hljs-keyword">async</span> <span class="hljs-function">(<span class="hljs-params">req, res, next</span>) =></span> {<br /> <span class="hljs-keyword">const</span> userAgent = req.<span class="hljs-title function_">get</span>(<span class="hljs-string">'user-agent'</span>) || <span class="hljs-string">'Unknown'</span>;<br /> <span class="hljs-keyword">const</span> referer = req.<span class="hljs-title function_">get</span>(<span class="hljs-string">'referer'</span>) || <span class="hljs-string">'Direct'</span>;<br /> <span class="hljs-keyword">const</span> ip = req.<span class="hljs-property">headers</span>[<span class="hljs-string">'x-forwarded-for'</span>] || req.<span class="hljs-property">connection</span>.<span class="hljs-property">remoteAddress</span>;<br /> <br /> <span class="hljs-comment">// Track page view</span><br /> <span class="hljs-keyword">await</span> <span class="hljs-title function_">trackPageView</span>({<br /> <span class="hljs-attr">path</span>: req.<span class="hljs-property">path</span>,<br /> <span class="hljs-attr">method</span>: req.<span class="hljs-property">method</span>,<br /> <span class="hljs-attr">userAgent</span>,<br /> <span class="hljs-attr">referer</span>,<br /> <span class="hljs-attr">ip</span>,<br /> <span class="hljs-attr">timestamp</span>: <span class="hljs-keyword">new</span> <span class="hljs-built_in">Date</span>()<br /> });<br /> <br /> <span class="hljs-keyword">await</span> <span class="hljs-title function_">next</span>();<br /> };<br />};<br /><br /><span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">trackPageView</span>(<span class="hljs-params">data</span>) </span>{<br /> <span class="hljs-comment">// Send analytics data to your tracking service</span><br /> <span class="hljs-comment">// or save to database</span><br />}</code></pre>
|
|
107
|
+
|
|
108
|
+
<h3>Request Validation Middleware</h3>
|
|
109
|
+
<pre><code class="hljs javascript"><span class="hljs-comment">// middleware/validation.js</span><br /><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-function">(<span class="hljs-params">config</span>) =></span> {<br /> <span class="hljs-keyword">return</span> <span class="hljs-keyword">async</span> <span class="hljs-function">(<span class="hljs-params">req, res, next</span>) =></span> {<br /> <span class="hljs-comment">// Add validation helpers to request object</span><br /> req.<span class="hljs-property">validate</span> = {<br /> <span class="hljs-attr">email</span>: <span class="hljs-function">(<span class="hljs-params">value</span>) =></span> {<br /> <span class="hljs-keyword">const</span> emailRegex = <span class="hljs-regexp">/^[^\s@]+@[^\s@]+\.[^\s@]+$/</span>;<br /> <span class="hljs-keyword">return</span> emailRegex.<span class="hljs-title function_">test</span>(value);<br /> },<br /> <span class="hljs-attr">required</span>: <span class="hljs-function">(<span class="hljs-params">value</span>) =></span> {<br /> <span class="hljs-keyword">return</span> value !== <span class="hljs-literal">undefined</span> && value !== <span class="hljs-literal">null</span> && value !== <span class="hljs-string">''</span>;<br /> },<br /> <span class="hljs-attr">minLength</span>: <span class="hljs-function">(<span class="hljs-params">value, min</span>) =></span> {<br /> <span class="hljs-keyword">return</span> <span class="hljs-keyword">typeof</span> value === <span class="hljs-string">'string'</span> && value.<span class="hljs-property">length</span> >= min;<br /> },<br /> <span class="hljs-attr">maxLength</span>: <span class="hljs-function">(<span class="hljs-params">value, max</span>) =></span> {<br /> <span class="hljs-keyword">return</span> <span class="hljs-keyword">typeof</span> value === <span class="hljs-string">'string'</span> && value.<span class="hljs-property">length</span> <= max;<br /> }<br /> };<br /> <br /> <span class="hljs-keyword">await</span> <span class="hljs-title function_">next</span>();<br /> };<br />};</code></pre>
|
|
110
|
+
|
|
111
|
+
<h2>Using Enhanced Requests in Routes</h2>
|
|
112
|
+
<p>Once middleware has enhanced your request object, you can use the added properties in your route handlers:</p>
|
|
113
|
+
|
|
114
|
+
<h3>Using Authentication Data</h3>
|
|
115
|
+
<pre><code class="hljs javascript"><span class="hljs-comment">// api/user/profile/GET.js</span><br /><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">req, res</span>) </span>{<br /> <span class="hljs-comment">// Check if user is authenticated (added by auth middleware)</span><br /> <span class="hljs-keyword">if</span> (!req.<span class="hljs-property">user</span>) {<br /> <span class="hljs-keyword">return</span> res.<span class="hljs-title function_">status</span>(<span class="hljs-number">401</span>).<span class="hljs-title function_">json</span>({ <span class="hljs-attr">error</span>: <span class="hljs-string">'Authentication required'</span> });<br /> }<br /> <br /> <span class="hljs-comment">// Check permissions (added by auth middleware)</span><br /> <span class="hljs-keyword">if</span> (!req.<span class="hljs-title function_">hasPermission</span>(<span class="hljs-string">'user:read'</span>)) {<br /> <span class="hljs-keyword">return</span> res.<span class="hljs-title function_">status</span>(<span class="hljs-number">403</span>).<span class="hljs-title function_">json</span>({ <span class="hljs-attr">error</span>: <span class="hljs-string">'Insufficient permissions'</span> });<br /> }<br /> <br /> <span class="hljs-keyword">const</span> profile = <span class="hljs-keyword">await</span> <span class="hljs-title function_">getUserProfile</span>(req.<span class="hljs-property">user</span>.<span class="hljs-property">id</span>);<br /> res.<span class="hljs-title function_">json</span>(profile);<br />}</code></pre>
|
|
116
|
+
|
|
117
|
+
<h3>Using Validation Helpers</h3>
|
|
118
|
+
<pre><code class="hljs javascript"><span class="hljs-comment">// api/user/POST.js</span><br /><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">req, res</span>) </span>{<br /> <span class="hljs-keyword">const</span> { name, email, password } = <span class="hljs-keyword">await</span> req.<span class="hljs-title function_">json</span>();<br /> <span class="hljs-keyword">const</span> errors = [];<br /> <br /> <span class="hljs-comment">// Use validation helpers added by validation middleware</span><br /> <span class="hljs-keyword">if</span> (!req.<span class="hljs-property">validate</span>.<span class="hljs-title function_">required</span>(name)) {<br /> errors.<span class="hljs-title function_">push</span>(<span class="hljs-string">'Name is required'</span>);<br /> }<br /> <br /> <span class="hljs-keyword">if</span> (!req.<span class="hljs-property">validate</span>.<span class="hljs-title function_">required</span>(email)) {<br /> errors.<span class="hljs-title function_">push</span>(<span class="hljs-string">'Email is required'</span>);<br /> } <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (!req.<span class="hljs-property">validate</span>.<span class="hljs-title function_">email</span>(email)) {<br /> errors.<span class="hljs-title function_">push</span>(<span class="hljs-string">'Invalid email format'</span>);<br /> }<br /> <br /> <span class="hljs-keyword">if</span> (!req.<span class="hljs-property">validate</span>.<span class="hljs-title function_">minLength</span>(password, <span class="hljs-number">8</span>)) {<br /> errors.<span class="hljs-title function_">push</span>(<span class="hljs-string">'Password must be at least 8 characters'</span>);<br /> }<br /> <br /> <span class="hljs-keyword">if</span> (errors.<span class="hljs-property">length</span> > <span class="hljs-number">0</span>) {<br /> <span class="hljs-keyword">return</span> res.<span class="hljs-title function_">status</span>(<span class="hljs-number">400</span>).<span class="hljs-title function_">json</span>({ errors });<br /> }<br /> <br /> <span class="hljs-comment">// Create user...</span><br /> <span class="hljs-keyword">const</span> user = <span class="hljs-keyword">await</span> <span class="hljs-title function_">createUser</span>({ name, email, password });<br /> res.<span class="hljs-title function_">status</span>(<span class="hljs-number">201</span>).<span class="hljs-title function_">json</span>(user);<br />}</code></pre>
|
|
119
|
+
|
|
120
|
+
<h2>Middleware Best Practices</h2>
|
|
121
|
+
|
|
122
|
+
<h3>Order Matters</h3>
|
|
123
|
+
<p>Middleware runs in the order specified in your configuration. Common ordering:</p>
|
|
124
|
+
<ol>
|
|
125
|
+
<li>Security headers (should run first)</li>
|
|
126
|
+
<li>CORS (before authentication)</li>
|
|
127
|
+
<li>Rate limiting (before heavy processing)</li>
|
|
128
|
+
<li>Authentication (before authorization)</li>
|
|
129
|
+
<li>Logging (can be early or late)</li>
|
|
130
|
+
<li>Compression (should run last)</li>
|
|
131
|
+
</ol>
|
|
132
|
+
|
|
133
|
+
<h3>Error Handling</h3>
|
|
134
|
+
<p>Always handle errors gracefully in custom middleware:</p>
|
|
135
|
+
<pre><code class="hljs javascript"><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-function">(<span class="hljs-params">config</span>) =></span> {<br /> <span class="hljs-keyword">return</span> <span class="hljs-keyword">async</span> <span class="hljs-function">(<span class="hljs-params">req, res, next</span>) =></span> {<br /> <span class="hljs-keyword">try</span> {<br /> <span class="hljs-comment">// Your middleware logic</span><br /> <span class="hljs-keyword">await</span> <span class="hljs-title function_">next</span>();<br /> } <span class="hljs-keyword">catch</span> (error) {<br /> <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">error</span>(<span class="hljs-string">'Middleware error:'</span>, error);<br /> <span class="hljs-comment">// Don't break the request chain</span><br /> <span class="hljs-keyword">await</span> <span class="hljs-title function_">next</span>();<br /> }<br /> };<br />};</code></pre>
|
|
136
|
+
|
|
137
|
+
<h3>Performance Considerations</h3>
|
|
138
|
+
<ul>
|
|
139
|
+
<li>Keep middleware lightweight - avoid heavy processing</li>
|
|
140
|
+
<li>Use async/await properly to avoid blocking</li>
|
|
141
|
+
<li>Cache expensive operations when possible</li>
|
|
142
|
+
<li>Consider the performance impact of middleware order</li>
|
|
143
|
+
</ul>
|
|
144
|
+
</main>
|
|
145
|
+
<div style="height:25vh"></div>
|
|
146
|
+
</body>
|
|
147
|
+
</html>
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<html lang="en" theme="auto">
|
|
2
|
+
<head>
|
|
3
|
+
<meta charset='utf-8'>
|
|
4
|
+
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
|
|
5
|
+
<title>Request & Response - Kempo Server</title>
|
|
6
|
+
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
|
7
|
+
<link rel="icon" type="image/png" sizes="48x48" href="media/icon48.png">
|
|
8
|
+
<link rel="manifest" href="manifest.json">
|
|
9
|
+
<link rel="stylesheet" href="essential.css" />
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<main>
|
|
13
|
+
<a href="./" class="btn">Home</a>
|
|
14
|
+
<h1>Request & Response Objects</h1>
|
|
15
|
+
<p>Learn how to work with HTTP requests and responses in Kempo Server.</p>
|
|
16
|
+
|
|
17
|
+
<h2>Request Object</h2>
|
|
18
|
+
<p>Kempo Server provides a request object that makes working with HTTP requests easier:</p>
|
|
19
|
+
|
|
20
|
+
<h3>Properties</h3>
|
|
21
|
+
<ul>
|
|
22
|
+
<li><code>request.params</code> - Route parameters from dynamic routes (e.g., <code>{ id: "123", info: "info" }</code>)</li>
|
|
23
|
+
<li><code>request.query</code> - Query string parameters as an object (e.g., <code>{ page: "1", limit: "10" }</code>)</li>
|
|
24
|
+
<li><code>request.path</code> - The pathname of the request URL</li>
|
|
25
|
+
<li><code>request.method</code> - HTTP method (GET, POST, etc.)</li>
|
|
26
|
+
<li><code>request.headers</code> - Request headers object</li>
|
|
27
|
+
<li><code>request.url</code> - Full request URL</li>
|
|
28
|
+
</ul>
|
|
29
|
+
|
|
30
|
+
<h3>Methods</h3>
|
|
31
|
+
<ul>
|
|
32
|
+
<li><code>await request.json()</code> - Parse request body as JSON</li>
|
|
33
|
+
<li><code>await request.text()</code> - Get request body as text</li>
|
|
34
|
+
<li><code>await request.body()</code> - Get raw request body as string</li>
|
|
35
|
+
<li><code>await request.buffer()</code> - Get request body as Buffer</li>
|
|
36
|
+
<li><code>request.get(headerName)</code> - Get specific header value</li>
|
|
37
|
+
<li><code>request.is(type)</code> - Check if content-type contains specified type</li>
|
|
38
|
+
</ul>
|
|
39
|
+
|
|
40
|
+
<h2>Response Object</h2>
|
|
41
|
+
<p>Kempo Server also provides a response object that makes sending responses easier:</p>
|
|
42
|
+
|
|
43
|
+
<h3>Methods</h3>
|
|
44
|
+
<ul>
|
|
45
|
+
<li><code>response.json(object)</code> - Send JSON response with automatic content-type</li>
|
|
46
|
+
<li><code>response.send(data)</code> - Send response (auto-detects content type)</li>
|
|
47
|
+
<li><code>response.html(htmlString)</code> - Send HTML response</li>
|
|
48
|
+
<li><code>response.text(textString)</code> - Send plain text response</li>
|
|
49
|
+
<li><code>response.status(code)</code> - Set status code (chainable)</li>
|
|
50
|
+
<li><code>response.set(field, value)</code> - Set header (chainable)</li>
|
|
51
|
+
<li><code>response.type(contentType)</code> - Set content type (chainable)</li>
|
|
52
|
+
<li><code>response.redirect(url, statusCode)</code> - Redirect to URL</li>
|
|
53
|
+
<li><code>response.cookie(name, value, options)</code> - Set cookie</li>
|
|
54
|
+
<li><code>response.clearCookie(name, options)</code> - Clear cookie</li>
|
|
55
|
+
</ul>
|
|
56
|
+
|
|
57
|
+
<h2>Request Examples</h2>
|
|
58
|
+
|
|
59
|
+
<h3>Accessing Route Parameters</h3>
|
|
60
|
+
<pre><code class="hljs javascript"><span class="hljs-comment">// api/user/[id]/GET.js</span><br /><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">request, response</span>) </span>{<br /> <span class="hljs-keyword">const</span> { id } = request.params;<br /> <span class="hljs-keyword">const</span> { includeDetails } = request.query;<br /> <br /> <span class="hljs-comment">// Fetch user data from database</span><br /> <span class="hljs-keyword">const</span> userData = <span class="hljs-keyword">await</span> getUserById(id);<br /> <br /> <span class="hljs-keyword">if</span> (!userData) {<br /> <span class="hljs-keyword">return</span> response.status(<span class="hljs-number">404</span>).json({ error: <span class="hljs-string">'User not found'</span> });<br /> }<br /> <br /> response.json(userData);<br />}</code></pre>
|
|
61
|
+
|
|
62
|
+
<h3>Handling JSON Data</h3>
|
|
63
|
+
<pre><code class="hljs javascript"><span class="hljs-comment">// api/user/[id]/POST.js</span><br /><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">request, response</span>) </span>{<br /> <span class="hljs-keyword">const</span> { id } = request.params;<br /> <br /> <span class="hljs-keyword">try</span> {<br /> <span class="hljs-keyword">const</span> updateData = <span class="hljs-keyword">await</span> request.json();<br /> <br /> <span class="hljs-comment">// Update user in database</span><br /> <span class="hljs-keyword">const</span> updatedUser = <span class="hljs-keyword">await</span> updateUser(id, updateData);<br /> <br /> response.json(updatedUser);<br /> } <span class="hljs-keyword">catch</span> (error) {<br /> response.status(<span class="hljs-number">400</span>).json({ error: <span class="hljs-string">'Invalid JSON'</span> });<br /> }<br />}</code></pre>
|
|
64
|
+
|
|
65
|
+
<h3>Working with Form Data</h3>
|
|
66
|
+
<pre><code class="hljs javascript"><span class="hljs-comment">// contact/POST.js</span><br /><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">request, response</span>) </span>{<br /> <span class="hljs-keyword">try</span> {<br /> <span class="hljs-keyword">const</span> body = <span class="hljs-keyword">await</span> request.text();<br /> <span class="hljs-keyword">const</span> formData = <span class="hljs-keyword">new</span> URLSearchParams(body);<br /> <span class="hljs-keyword">const</span> name = formData.get(<span class="hljs-string">'name'</span>);<br /> <span class="hljs-keyword">const</span> email = formData.get(<span class="hljs-string">'email'</span>);<br /> <span class="hljs-keyword">const</span> message = formData.get(<span class="hljs-string">'message'</span>);<br /> <br /> <span class="hljs-comment">// Process form data...</span><br /> <span class="hljs-keyword">await</span> sendContactEmail({ name, email, message });<br /> <br /> response.html(<span class="hljs-string">'<h1>Thank you for your message!</h1>'</span>);<br /> } <span class="hljs-keyword">catch</span> (error) {<br /> response.status(<span class="hljs-number">400</span>).html(<span class="hljs-string">'<h1>Error processing form</h1>'</span>);<br /> }<br />}</code></pre>
|
|
67
|
+
|
|
68
|
+
<h3>Checking Headers</h3>
|
|
69
|
+
<pre><code class="hljs javascript"><span class="hljs-comment">// api/upload/POST.js</span><br /><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">request, response</span>) </span>{<br /> <span class="hljs-comment">// Check if request contains JSON data</span><br /> <span class="hljs-keyword">if</span> (request.is(<span class="hljs-string">'application/json'</span>)) {<br /> <span class="hljs-keyword">const</span> data = <span class="hljs-keyword">await</span> request.json();<br /> <span class="hljs-comment">// Handle JSON data</span><br /> }<br /> <br /> <span class="hljs-comment">// Check specific headers</span><br /> <span class="hljs-keyword">const</span> authHeader = request.get(<span class="hljs-string">'authorization'</span>);<br /> <span class="hljs-keyword">const</span> userAgent = request.get(<span class="hljs-string">'user-agent'</span>);<br /> <br /> <span class="hljs-comment">// Check request method</span><br /> <span class="hljs-keyword">if</span> (request.method === <span class="hljs-string">'POST'</span>) {<br /> <span class="hljs-comment">// Handle POST request</span><br /> }<br /> <br /> response.json({ success: <span class="hljs-literal">true</span> });<br />}</code></pre>
|
|
70
|
+
|
|
71
|
+
<h2>Response Examples</h2>
|
|
72
|
+
|
|
73
|
+
<h3>Different Response Types</h3>
|
|
74
|
+
<pre><code class="hljs javascript"><span class="hljs-comment">// Different response types</span><br /><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">request, response</span>) </span>{<br /> <span class="hljs-comment">// JSON response</span><br /> response.json({ message: <span class="hljs-string">'Hello World'</span> });<br /> <br /> <span class="hljs-comment">// HTML response</span><br /> response.html(<span class="hljs-string">'<h1>Hello World</h1>'</span>);<br /> <br /> <span class="hljs-comment">// Text response</span><br /> response.text(<span class="hljs-string">'Hello World'</span>);<br /> <br /> <span class="hljs-comment">// Status code chaining</span><br /> response.status(<span class="hljs-number">201</span>).json({ created: <span class="hljs-literal">true</span> });<br /> <br /> <span class="hljs-comment">// Custom headers</span><br /> response.set(<span class="hljs-string">'X-Custom-Header'</span>, <span class="hljs-string">'value'</span>).json({ data: <span class="hljs-string">'test'</span> });<br /> <br /> <span class="hljs-comment">// Redirect</span><br /> response.redirect(<span class="hljs-string">'/login'</span>);<br /> <br /> <span class="hljs-comment">// Set cookies</span><br /> response.cookie(<span class="hljs-string">'session'</span>, <span class="hljs-string">'abc123'</span>, { httpOnly: <span class="hljs-literal">true</span> }).json({ success: <span class="hljs-literal">true</span> });<br />}</code></pre>
|
|
75
|
+
|
|
76
|
+
<h3>Error Handling</h3>
|
|
77
|
+
<pre><code class="hljs javascript"><span class="hljs-comment">// api/user/[id]/DELETE.js</span><br /><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">request, response</span>) </span>{<br /> <span class="hljs-keyword">const</span> { id } = request.params;<br /> <br /> <span class="hljs-keyword">try</span> {<br /> <span class="hljs-keyword">const</span> user = <span class="hljs-keyword">await</span> getUserById(id);<br /> <br /> <span class="hljs-keyword">if</span> (!user) {<br /> <span class="hljs-keyword">return</span> response.status(<span class="hljs-number">404</span>).json({<br /> error: <span class="hljs-string">'User not found'</span>,<br /> code: <span class="hljs-string">'USER_NOT_FOUND'</span><br /> });<br /> }<br /> <br /> <span class="hljs-keyword">await</span> deleteUser(id);<br /> <br /> response.status(<span class="hljs-number">200</span>).json({<br /> message: <span class="hljs-string">'User deleted successfully'</span>,<br /> deletedAt: <span class="hljs-keyword">new</span> <span class="hljs-built_in">Date</span>().toISOString()<br /> });<br /> } <span class="hljs-keyword">catch</span> (error) {<br /> response.status(<span class="hljs-number">500</span>).json({<br /> error: <span class="hljs-string">'Internal server error'</span>,<br /> code: <span class="hljs-string">'INTERNAL_ERROR'</span><br /> });<br /> }<br />}</code></pre>
|
|
78
|
+
|
|
79
|
+
<h3>Content Negotiation</h3>
|
|
80
|
+
<pre><code class="hljs javascript"><span class="hljs-comment">// api/user/[id]/GET.js</span><br /><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">request, response</span>) </span>{<br /> <span class="hljs-keyword">const</span> { id } = request.params;<br /> <span class="hljs-keyword">const</span> userData = <span class="hljs-keyword">await</span> getUserById(id);<br /> <br /> <span class="hljs-comment">// Check Accept header to determine response format</span><br /> <span class="hljs-keyword">const</span> acceptHeader = request.get(<span class="hljs-string">'accept'</span>);<br /> <br /> <span class="hljs-keyword">if</span> (acceptHeader && acceptHeader.includes(<span class="hljs-string">'text/html'</span>)) {<br /> <span class="hljs-comment">// Return HTML representation</span><br /> response.html(<span class="hljs-string">`<br /> <div><br /> <h1>${userData.name}</h1><br /> <p>Email: ${userData.email}</p><br /> </div><br /> `</span>);<br /> } <span class="hljs-keyword">else</span> {<br /> <span class="hljs-comment">// Default to JSON</span><br /> response.json(userData);<br /> }<br />}</code></pre>
|
|
81
|
+
|
|
82
|
+
<h3>Working with Cookies</h3>
|
|
83
|
+
<pre><code class="hljs javascript"><span class="hljs-comment">// api/auth/login/POST.js</span><br /><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">request, response</span>) </span>{<br /> <span class="hljs-keyword">const</span> { username, password } = <span class="hljs-keyword">await</span> request.json();<br /> <br /> <span class="hljs-keyword">const</span> user = <span class="hljs-keyword">await</span> authenticateUser(username, password);<br /> <br /> <span class="hljs-keyword">if</span> (!user) {<br /> <span class="hljs-keyword">return</span> response.status(<span class="hljs-number">401</span>).json({ error: <span class="hljs-string">'Invalid credentials'</span> });<br /> }<br /> <br /> <span class="hljs-comment">// Set session cookie</span><br /> <span class="hljs-keyword">const</span> sessionToken = <span class="hljs-keyword">await</span> createSessionToken(user.id);<br /> <br /> response<br /> .cookie(<span class="hljs-string">'session'</span>, sessionToken, {<br /> httpOnly: <span class="hljs-literal">true</span>,<br /> secure: <span class="hljs-literal">true</span>,<br /> sameSite: <span class="hljs-string">'strict'</span>,<br /> maxAge: <span class="hljs-number">24</span> * <span class="hljs-number">60</span> * <span class="hljs-number">60</span> * <span class="hljs-number">1000</span> <span class="hljs-comment">// 24 hours</span><br /> })<br /> .json({<br /> message: <span class="hljs-string">'Login successful'</span>,<br /> user: {<br /> id: user.id,<br /> username: user.username,<br /> email: user.email<br /> }<br /> });<br />}</code></pre>
|
|
84
|
+
|
|
85
|
+
<h2>Advanced Request Handling</h2>
|
|
86
|
+
|
|
87
|
+
<h3>File Upload Handling</h3>
|
|
88
|
+
<pre><code class="hljs javascript"><span class="hljs-comment">// api/upload/POST.js</span><br /><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">request, response</span>) </span>{<br /> <span class="hljs-keyword">try</span> {<br /> <span class="hljs-comment">// Get raw buffer for file upload</span><br /> <span class="hljs-keyword">const</span> buffer = <span class="hljs-keyword">await</span> request.buffer();<br /> <span class="hljs-keyword">const</span> contentType = request.get(<span class="hljs-string">'content-type'</span>);<br /> <br /> <span class="hljs-comment">// Save file to disk</span><br /> <span class="hljs-keyword">const</span> filename = <span class="hljs-string">`upload_${Date.now()}.${getExtensionFromMimeType(contentType)}`</span>;<br /> <span class="hljs-keyword">await</span> fs.writeFile(<span class="hljs-string">`./uploads/${filename}`</span>, buffer);<br /> <br /> response.json({<br /> message: <span class="hljs-string">'File uploaded successfully'</span>,<br /> filename: filename,<br /> size: buffer.length<br /> });<br /> } <span class="hljs-keyword">catch</span> (error) {<br /> response.status(<span class="hljs-number">400</span>).json({ error: <span class="hljs-string">'Upload failed'</span> });<br /> }<br />}</code></pre>
|
|
89
|
+
|
|
90
|
+
<h3>Request Validation</h3>
|
|
91
|
+
<pre><code class="hljs javascript"><span class="hljs-comment">// api/user/POST.js</span><br /><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">request, response</span>) </span>{<br /> <span class="hljs-keyword">try</span> {<br /> <span class="hljs-keyword">const</span> userData = <span class="hljs-keyword">await</span> request.json();<br /> <br /> <span class="hljs-comment">// Validate required fields</span><br /> <span class="hljs-keyword">const</span> requiredFields = [<span class="hljs-string">'name'</span>, <span class="hljs-string">'email'</span>, <span class="hljs-string">'password'</span>];<br /> <span class="hljs-keyword">const</span> missingFields = requiredFields.filter(<span class="hljs-function"><span class="hljs-params">field</span> =></span> !userData[field]);<br /> <br /> <span class="hljs-keyword">if</span> (missingFields.length > <span class="hljs-number">0</span>) {<br /> <span class="hljs-keyword">return</span> response.status(<span class="hljs-number">400</span>).json({<br /> error: <span class="hljs-string">'Missing required fields'</span>,<br /> missingFields<br /> });<br /> }<br /> <br /> <span class="hljs-comment">// Validate email format</span><br /> <span class="hljs-keyword">const</span> emailRegex = <span class="hljs-regexp">/^[^\s@]+@[^\s@]+\.[^\s@]+$/</span>;<br /> <span class="hljs-keyword">if</span> (!emailRegex.test(userData.email)) {<br /> <span class="hljs-keyword">return</span> response.status(<span class="hljs-number">400</span>).json({<br /> error: <span class="hljs-string">'Invalid email format'</span><br /> });<br /> }<br /> <br /> <span class="hljs-comment">// Create user</span><br /> <span class="hljs-keyword">const</span> newUser = <span class="hljs-keyword">await</span> createUser(userData);<br /> <br /> response.status(<span class="hljs-number">201</span>).json({<br /> message: <span class="hljs-string">'User created successfully'</span>,<br /> user: {<br /> id: newUser.id,<br /> name: newUser.name,<br /> email: newUser.email<br /> }<br /> });<br /> } <span class="hljs-keyword">catch</span> (error) {<br /> response.status(<span class="hljs-number">400</span>).json({ error: <span class="hljs-string">'Invalid request data'</span> });<br /> }<br />}</code></pre>
|
|
92
|
+
</main>
|
|
93
|
+
<div style="height:25vh"></div><div style="height:25vh"></div>
|
|
94
|
+
</body>
|
|
95
|
+
</html>
|