How do you build your API for example for registra...
# ktor
r
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
You can share code between the client and the server and implement this logic in
common
.
d
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
it's usually so few constraints that developing a system with server communication is more trouble than it's worth
g
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