Hacker News new | past | comments | ask | show | jobs | submit login

Yes I noticed v5! I love it so much. The great thing about itty is you can integrate anything really easily.

I'm in the progress of making a simple middleware based on zod to parse not only request body, but also params, headers, etc. Zod is really powerful and you could even use it to do stuff like parse jwt tokens and have complete type inference.

Perhaps my only issue with this approach is that you rely on a wrapper function to correctly pass the generics fron the middleware to the main handler.

Another possible approach is using types-per-route but then it's hard to enforce that the validator agrees with the handler itself.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: