Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to validate express js form

// Validation rules.var loginValidate = [  check('username', 'Username Must Be an Email Address').isEmail(),  check('password').isLength({ min: 8 })  .withMessage('Password Must Be at Least 8 Characters')  .matches('[0-9]').withMessage('Password Must Contain a Number')  .matches('[A-Z]').withMessage('Password Must Contain an Uppercase Letter')];// Process user input.app.post('/login', loginValidate, (req, res) => {  // Insert Login Code Here});
Source by medium.com #
 
PREVIOUS NEXT
Tagged: #validate #express #js #form
ADD COMMENT
Topic
Name
2+2 =