]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/middlewares/pagination.ts
cadd769805ae7f393e14187a867db86c6d60f56d
[github/Chocobozzz/PeerTube.git] / server / middlewares / pagination.ts
1 import { PAGINATION_COUNT_DEFAULT } from '../initializers'
2
3 function setPagination (req, res, next) {
4 if (!req.query.start) req.query.start = 0
5 else req.query.start = parseInt(req.query.start, 10)
6
7 if (!req.query.count) req.query.count = PAGINATION_COUNT_DEFAULT
8 else req.query.count = parseInt(req.query.count, 10)
9
10 return next()
11 }
12
13 // ---------------------------------------------------------------------------
14
15 export {
16 setPagination
17 }