PeerTube/server/middlewares/validators/pagination.ts

18 lines
500 B
TypeScript
Raw Normal View History

2017-05-15 22:22:03 +02:00
import { checkErrors } from './utils'
import { logger } from '../../helpers'
2017-05-15 22:22:03 +02:00
function paginationValidator (req, res, next) {
2016-05-17 21:03:00 +02:00
req.checkQuery('start', 'Should have a number start').optional().isInt()
req.checkQuery('count', 'Should have a number count').optional().isInt()
2016-05-17 21:03:00 +02:00
logger.debug('Checking pagination parameters', { parameters: req.query })
checkErrors(req, res, next)
}
// ---------------------------------------------------------------------------
2017-05-15 22:22:03 +02:00
export {
paginationValidator
}