How do you build your API for example for registration, there is password field, it has some constraints(length, allowed characters)
are these constraints also hardcoded on client side, or do you have and endpoint in the API to retrieve constraints information?
r
Robert Jaros
04/25/2019, 11:34 AM
You can share code between the client and the server and implement this logic in
common
.
d
david-wg2
04/25/2019, 11:34 AM
there isn't a right or wrong way of doing this, but what i've usually seen people do is hardcode the constraints in the client
david-wg2
04/25/2019, 11:35 AM
it's usually so few constraints that developing a system with server communication is more trouble than it's worth
g
galex
05/03/2019, 8:02 AM
I do both. I want to check the constraints on clients to provide useful feedback on errors then I check again on the server (with the same function from common) to validate the data before saving it. Who knows who will call this API besides my apps to try to cheat or whatever