Friday 27 October 2017

Help Express Validator with App.route

Can I get help with what I'm doing wrong here ? Also is there a node slack channel ?app.route('/laundromats', [ check('name', 'Invalid name') check('address', 'Invalid address').notEmpty().isAlpha() check('email', 'Invalid email').isEmail() check('phone', 'Invalid phone #').isMobilePhone() check('password', 'Invalid').notEmpty().isAlpha() ]) .post( function (req, res, next){ const errors = req.validationErrors() if (errors) { return res.status(422).json( errors: errors.mapped()) } const laudry = matchedData(req) res.json(laundry) })

Submitted October 27, 2017 at 10:34PM by chabv

No comments:

Post a Comment