javascript
1 2const { check, validationResult } = require('express-validator/check'); 3 4app.post('/user', [ 5 // username must be an email 6 check('username').isEmail(), 7 // password must be at least 5 chars long 8 check('password').isLength({ min: 5 }) 9], (req, res) => { 10 // Finds the validation errors in this request and wraps them in an object with handy functions 11 const errors = validationResult(req); 12 if (!errors.isEmpty()) { 13 return res.status(422).json({ errors: errors.array() }); 14 } 15 16
app.postの第二引数に配列を渡していますが
なぜ渡せるのでしょうか?
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。