feat: add validators for username, email, password

* not passed yet
This commit is contained in:
Lin, Hung-Shin committed 2023-11-01 15:02:30 +08:00
1 parent c551f0c92b
commit 1c9d69a8e0
4 files changed
+82 -76

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
import { validationResult } from 'express-validator'
export function noError(req, res, next) {
const result = validationResult(req)
if (result.isEmpty()) {
next()
return
}
console.log(result.array())
res.status(400).json({
errors: result.array(),
})
}