Ask HN: How would you validate data on both back end and front end?
Dear HN,
in most projects you want to do validation of the submitted data both client- and server-side.
When using node/js the validation is simple, of course, because the validation rules are written once. But, more often than not I don't work in JS or use another server side language.
My Question: Do you know of any good way to validate objects/data structures in a language agnostic way?
I have considered something like JSON-schema or some sort of code generation.
Any ideas?
5 comments
[ 14.9 ms ] story [ 283 ms ] thread- is "title" set, - when "age" is set "birthday" must not be set. - the cart can have a max of 10 items.
Put your full detailed validation rules server-side.