aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/reqValidators/pagination.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-05-13 18:10:46 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-05-13 18:10:46 +0200
commitfbf1134e3e6b386c9ec5a3946c61f3faf84397fb (patch)
tree9071ea72c86e83bb07d8ec681a54daff2e0eb7b9 /server/middlewares/reqValidators/pagination.js
parentf67e976fdccbfe6432c1176148d194c980a5585a (diff)
downloadPeerTube-fbf1134e3e6b386c9ec5a3946c61f3faf84397fb.tar.gz
PeerTube-fbf1134e3e6b386c9ec5a3946c61f3faf84397fb.tar.zst
PeerTube-fbf1134e3e6b386c9ec5a3946c61f3faf84397fb.zip
Introduce paginations in videos listing
Diffstat (limited to 'server/middlewares/reqValidators/pagination.js')
-rw-r--r--server/middlewares/reqValidators/pagination.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/server/middlewares/reqValidators/pagination.js b/server/middlewares/reqValidators/pagination.js
new file mode 100644
index 000000000..ca8375396
--- /dev/null
+++ b/server/middlewares/reqValidators/pagination.js
@@ -0,0 +1,21 @@
1'use strict'
2
3const checkErrors = require('./utils').checkErrors
4const logger = require('../../helpers/logger')
5
6const reqValidatorsPagination = {
7 pagination: pagination
8}
9
10function pagination (req, res, next) {
11 req.checkParams('start', 'Should have a number start').optional().isInt()
12 req.checkParams('count', 'Should have a number count').optional().isInt()
13
14 logger.debug('Checking pagination parameters', { parameters: req.params })
15
16 checkErrors(req, res, next)
17}
18
19// ---------------------------------------------------------------------------
20
21module.exports = reqValidatorsPagination