First typescript iteration

This commit is contained in:
Chocobozzz 2017-05-15 22:22:03 +02:00
parent d5f345ed4c
commit 65fcc3119c
113 changed files with 1961 additions and 1784 deletions

View file

@ -0,0 +1,21 @@
import { inspect } from 'util'
import { logger } from '../../helpers'
function checkErrors (req, res, next, statusCode?) {
if (statusCode === undefined) statusCode = 400
const errors = req.validationErrors()
if (errors) {
logger.warn('Incorrect request parameters', { path: req.originalUrl, err: errors })
return res.status(statusCode).send('There have been validation errors: ' + inspect(errors))
}
return next()
}
// ---------------------------------------------------------------------------
export {
checkErrors
}