mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
feat: add validators for username, email, password
* not passed yet
This commit is contained in:
1 parent
c551f0c92b
commit
1c9d69a8e0
4 files changed
+82
-76
No files matched your search
@@ -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(),
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user