PeerTube/server/middlewares/validators/pagination.ts

18 lines
500 B
TypeScript
Raw Normal View History

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