From fff341d3cb28febeec9e448debae1bb930eb4ff2 Mon Sep 17 00:00:00 2001 From: Dave Smith-Hayes Date: Wed, 21 Feb 2024 21:07:02 -0500 Subject: [PATCH] Add Zod validation --- server/bun.lockb | Bin 7268 -> 8039 bytes server/package.json | 4 +++- server/src/middleware/form-to-json.ts | 11 ----------- server/src/routes/user.ts | 10 ---------- 4 files changed, 3 insertions(+), 22 deletions(-) delete mode 100644 server/src/middleware/form-to-json.ts diff --git a/server/bun.lockb b/server/bun.lockb index 766be32f1bb449246685f7329488bc9f93663f8d..f42c1c3f90607371ae9905d5d13459d136947d72 100755 GIT binary patch delta 1811 zcmcIle@v8h82^6XyOaC%%CEbF!w_RBvbq;|3F1=jAlZm6XiW1og^dLz1l-Aw0u~LB4>#98J=>QL&+~nL zeV_Mvp1YRyhwE)Ad3?flYjNxFZ`v2f_HHTdzVp+ieeYiW3vx$KT-R~O0JS|3@XE{jG!^ncr|Cg^9KHi)X-G33b~=@B_Hf1k?F3w-zI zkuMD|l{+Abm+5y}G7rAB($E3z+#eZ_N-1c7{+JDq76y0{%y2z_8s@p1?*^yfHjLnn zgjyW9@EE@i!-88_&0#@s@$KN$xcMn)*0=?Y03#X~-v;w2Is{Iwo1cefty|D*U_|TU z1u(C5M>b=uf>4h5OlDdN`8_ywZUJ*>(Yb^?EsP*EX<Yxg$PMbB_kr#;Rz=OiIDCih(Y=dV>fjkkf&|;DzJJ)fhZH z42F^0VH6?W=-~#aG-s7SrTC`I-&?iRB1>u zr{=_YrO*QpCg`}3G z5EP0+k~?xuDUcoMN8+Inlp3M(nowVFwxa;axPF_QS<;y0S|w+$s;_LR@Vx+6Ef2?% zAGB#x*NZ^qKmxrr-^EL1DOE~iOx=>|ViI_1x+Kfeqf7fzCw|s9ChZB}O`0T2GGqNv zZ!KJ*uEc_y`e(bQ;|2u&4yKGz+j`*_YdRl-aGSkSU9dBwt^V%uvzN$AsuEgVwew=) zkTs`gM&P(=X!@6y>?<{^PbMFIYEuMvWv5F{DfOOgBPiQ6Cq85rN^JHFb?tVhJlC;i zDBCIUT{1p1O-ff6^WifGn?IfkoRR#tR|Q`IR8Yq(5I%G7?z(?>&EIu*F+(Ud@V08|in(iGNi0D@w(SO)qO^vtmI+FzJ%tgL zGB0XSK@`5nseyCme&@{jX3m+J`_cQs zGoltfmnP3Q2WCBY>(4wKm>X$?$#*N?ruP?BH(%Qg%Wu!VaEZ8Nj0WZ1Ee>15y`vP5pCus`;JrKsL&;@1;NaoGnaF-A*|0G&E7I54R5K@i7j9>$o?Cq0(XsrNz(2K7Fu#F*YE^~mTnc%^$X zhDa^QIAQQY8O99NgA|hBL01ua8gx~WLW6}huNxVVux1;D0SRl~r#Fbpzi75krNMsE zgcytyq!Zwc-xKtI0xKY|Bpmr)k^LDM293vXy~&R`CI$OVevom>6u>8hip_q|W1l&I zy=Dbp6H37%O8^Tk3JzQRV8R%oSA=S;ez4#vYXFC=3N8>*uu2J_M^SKD@k1(ZwFU4K zq02Tuq~RArV>Tt)kh%!b_Ox!iFxNO33icVZpJX?<&?R!R-U@yz2CBD%Q^`TxYY`^Oo)E$$Z?cwE&f%> zpUkSgxFo@MI!|$|HuLfML$gEapYtUsQQc~31^otakxpt&erbBF@513{Z4wN4)N-}N zz51IN-4q($Fj-S2!Nx?~q5x|g4s)SB0SoPv%v$rlB%E>Kb%z`0a$V6%rz)d+ts#0l HHwwQ14A9Ly diff --git a/server/package.json b/server/package.json index 4019037..5db8e7e 100644 --- a/server/package.json +++ b/server/package.json @@ -3,9 +3,11 @@ "dev": "bun run --hot src/index.ts" }, "dependencies": { + "@hono/zod-validator": "^0.1.11", "hono": "^4.0.3", "mariadb": "^3.2.3", - "podcast": "^2.0.1" + "podcast": "^2.0.1", + "zod": "^3.22.4" }, "devDependencies": { "@types/bun": "latest" diff --git a/server/src/middleware/form-to-json.ts b/server/src/middleware/form-to-json.ts deleted file mode 100644 index 5750da0..0000000 --- a/server/src/middleware/form-to-json.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Context } from 'hono'; - -export default async function parsedForm(c: Context, next) { - if (c.req.method == 'POST') { - if (c.req.header('Content-Type') === 'application/x-www-form-urlencoded') { - - } - } - - next(); -} diff --git a/server/src/routes/user.ts b/server/src/routes/user.ts index 4b18856..c75a5c4 100644 --- a/server/src/routes/user.ts +++ b/server/src/routes/user.ts @@ -35,14 +35,4 @@ app.post('/register', async (c: Context) => { } }); -app.post('/login', async (c: Context) => { - - return c.json({ "success": true }); -}); - -app.post('/create/channel', async (c: Context) => { - - return c.json({ "success": true }); -}); - export default app;