JavaScript验证在客户端和Node.js服务器上都有效吗?

时间:2020-12-26 16:56:44

What are my options for using the same JavaScript code to validate both on client side and on server side (Node.js)?

使用相同的JavaScript代码在客户端和服务器端(Node.js)进行验证有哪些选择?

2 个解决方案

#1


8  

Take a look at revalidator. It is described as "A cross-browser / node.js validator used by resourceful and flatiron."

看看revalidator。它被描述为“资源丰富和flatiron使用的跨浏览器/ node.js验证器”。

#2


-15  

None, you are validating entirely different criteria on the server-side. Client-side validation is purely user-acceptance criteria and has nothing to do with security. Server-side validation almost exclusively concerned with security.

没有,您在服务器端验证完全不同的标准。客户端验证纯粹是用户验收标准,与安全性无关。服务器端验证几乎只涉及安全性。

#1


8  

Take a look at revalidator. It is described as "A cross-browser / node.js validator used by resourceful and flatiron."

看看revalidator。它被描述为“资源丰富和flatiron使用的跨浏览器/ node.js验证器”。

#2


-15  

None, you are validating entirely different criteria on the server-side. Client-side validation is purely user-acceptance criteria and has nothing to do with security. Server-side validation almost exclusively concerned with security.

没有,您在服务器端验证完全不同的标准。客户端验证纯粹是用户验收标准,与安全性无关。服务器端验证几乎只涉及安全性。