]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/middlewares/validators/pagination.ts
de719c05bc42fd7f80c2a414332205c535655e5d
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / pagination.ts
1 import { checkErrors } from './utils'
2 import { logger } from '../../helpers'
3
4 function paginationValidator (req, res, next) {
5 req.checkQuery('start', 'Should have a number start').optional().isInt()
6 req.checkQuery('count', 'Should have a number count').optional().isInt()
7
8 logger.debug('Checking pagination parameters', { parameters: req.query })
9
10 checkErrors(req, res, next)
11 }
12
13 // ---------------------------------------------------------------------------
14
15 export {
16 paginationValidator
17 }