Where to validate Mongoose Schema - Frontend or Backend?
I'm building a simple app with a login form and currently working on the backend.
While creating the Mongoose schema to store user data, should I add validations like required, minLength, lowercase, match (for regex), etc., directly in the schema?
Also, should I add similar validations in the frontend form as well — or is backend validation enough?
Just want to understand what’s the best practice here: frontend, backend, or both?
While creating the Mongoose schema to store user data, should I add validations like required, minLength, lowercase, match (for regex), etc., directly in the schema?
Also, should I add similar validations in the frontend form as well — or is backend validation enough?
Just want to understand what’s the best practice here: frontend, backend, or both?
