resource-router-middleware
resource-router-middleware copied to clipboard
Pagination params
How can I load only some records ?
examples : http://localhost:4040/api/ibge/2 http://localhost:4040/api/ibge?limit=10&page=3
thanks
i ended up doing sth like this for ?limit=10&offset=10 with max limit 500 and defaults 100 & 0 respectively while using rethinkdb as db
index({ query }, res) {
var limit = parseInt(query.limit) || 100
limit = limit > 500 ? 500 : limit
var offset = parseInt(query.offset) || 0
r.db('database').table('table').slice(offset, offset + limit).run(db, toRes(res))
},