Thursday 12 April 2018

How should I validate JSON in Koa?

I am making an API which will take JSON as an input via PUT/POST and I want to ensure a few things like certain fields need to exist, certain fields need to be numbers, certain fields can be optional etc.I found a koa-validator but it's not had any change in 2 years on github and seems not to be popular enough for me to trust enough in my production level koa API.How would you guys approach this? I could do it all vanilla but I feel like this is an issue a lot of devs have probably run into and therefore there's probably a better way.Thanks

Submitted April 12, 2018 at 03:40PM by Crypto_bismol

No comments:

Post a Comment