Example sharing validation code between front-end Javascript and backend APIs