mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-03 17:59:37 +02:00
Prepare folders structure for angular app
This commit is contained in:
parent
b2ff5e3e68
commit
b9a3e09ad5
60 changed files with 13 additions and 86 deletions
25
server/middlewares/reqValidators/utils.js
Normal file
25
server/middlewares/reqValidators/utils.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
'use strict'
|
||||
|
||||
var util = require('util')
|
||||
|
||||
var logger = require('../../helpers/logger')
|
||||
|
||||
var reqValidatorsUtils = {
|
||||
checkErrors: checkErrors
|
||||
}
|
||||
|
||||
function checkErrors (req, res, next, status_code) {
|
||||
if (status_code === undefined) status_code = 400
|
||||
var errors = req.validationErrors()
|
||||
|
||||
if (errors) {
|
||||
logger.warn('Incorrect request parameters', { path: req.originalUrl, err: errors })
|
||||
return res.status(status_code).send('There have been validation errors: ' + util.inspect(errors))
|
||||
}
|
||||
|
||||
return next()
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
module.exports = reqValidatorsUtils
|
Loading…
Add table
Add a link
Reference in a new issue