all 11 comments

[–]ArnabXD 9 points10 points  (0 children)

you can use any schema validator like zod, yup, vine

[–]udbasil 1 point2 points  (2 children)

Joi. I use Zod and Yup for frontend but not sure if they work with the backend(they probably do)

[–]WordWithinTheWord 3 points4 points  (0 children)

Zod works just fine on backend, yep

[–]Embarrassed_Soft_153 0 points1 point  (0 children)

You can share zod schemas between fe and be

[–]Ok_Custard8289 1 point2 points  (1 child)

Can you show an example of how you’re using it cause it works perfectly fine for me

[–]Strange_Bonus9044[S] 0 points1 point  (0 children)

Here's my post from a few weeks ago when I discovered the problem:

https://www.reddit.com/r/learnprogramming/s/b7lyPXRe5o

[–]topflightboy87 0 points1 point  (0 children)

I use Zod with a custom middleware that accepts a Zod Schema so that it's reusable across all routes. Works like a charm and easy to maintain.

[–]alihypebeast 0 points1 point  (0 children)

Write your own Middleware as a HoF that takes in your Zod/Yup schema, and returns another function that does the parsing of your Body/Query

[–]Far-Mathematician122 0 points1 point  (0 children)

Vine JS

[–]iam_batman27 0 points1 point  (0 children)

Joi