简体   繁体   中英

Field validations at frontend or backend? Which is better?

I'm developing a login and registration form using angular-6 as frontend and nodeJs as backend. So just want to know which is better, field validation in Angular or in Node?

It's best to do it on both, frontend and backend. The backend validation is for security (frontend can be easily faked). The frontend validation is for better usability (direct feedback without a roundtrip to the server).

@RajanKumar I will suggest doing field validation on the frontend side because Front-end validation (javascript) can easily be bypassed. It should only be used to improve the "user experience". It reduces the load on the server

Use Back-end validation if you required to check the data is coming from frontend side is valid or not for example at the time of signUP check where the email address is already exists or not.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM