aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/pagination.js
diff options
context:
space:
mode:
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