PeerTube/server/middlewares/validators/pagination.js

22 lines
590 B
JavaScript
Raw Normal View History

'use strict'
const checkErrors = require('./utils').checkErrors
const logger = require('../../helpers/logger')
2016-07-01 09:16:40 -05:00
const validatorsPagination = {
pagination: pagination
}
function pagination (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)
}
// ---------------------------------------------------------------------------
2016-07-01 09:16:40 -05:00
module.exports = validatorsPagination