mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
14 lines
281 B
JavaScript
14 lines
281 B
JavaScript
import { validationResult } from 'express-validator'
|
|
|
|
export function noError(req, res, next) {
|
|
const result = validationResult(req)
|
|
if (result.isEmpty()) {
|
|
next()
|
|
return
|
|
}
|
|
res.status(400).json({
|
|
message: 'Validation failed',
|
|
errors: result.array(),
|
|
})
|
|
}
|