aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/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/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/pagination.js')
-rw-r--r--server/middlewares/pagination.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/server/middlewares/pagination.js b/server/middlewares/pagination.js
new file mode 100644
index 000000000..2a426ec28
--- /dev/null
+++ b/server/middlewares/pagination.js
@@ -0,0 +1,18 @@
1'use strict'
2
3const paginationMiddleware = {
4 setPagination: setPagination
5}
6
7function setPagination (req, res, next) {
8 if (!req.query.start) req.query.start = 0
9 else req.query.start = parseInt(req.query.start)
10 if (!req.query.count) req.query.count = 15
11 else req.query.count = parseInt(req.query.count)
12
13 return next()
14}
15
16// ---------------------------------------------------------------------------
17
18module.exports = paginationMiddleware