Here we go again with topic what was asked many times all over internet, but I not found any good enough answer:
What are best practices in making client and server side validations synced?
I was not doing it in web apps I was making (I just had duplicated validations), but now when I started with React Native and REST API as backend I asked myself if I have nerves to do every validation twice and edit it twice if something change.
Options what are getting into my mind:
- Not share validation at all (Have two validation rules, two validator functions, two regexes set...)
- Have just server side validation (so much 2000's am I right?)
- Having just client side validation (I AM JOKING!)
- Let client app download at start some rules/sets from server and use them
I was really thinking about the 4th option, but maybe its too complicated (regexes, functions, etc. cannot be moved easily trough internet - JSON for example), but it is also good for on-air updates etc.
I really dont know.
Any ideas, tips, best practices?