pagina
Paginates a MongoDB collection and add links to the next/prev page.
Install
npm install mongo-paginate --save
Examples
const express = ;const app = ;const paginate = ;// without pagination// GET http://localhost/itemsapp;// [{a:1, b:1}, {a:2, b:2}, {a:3, b:3}, {a:4, b:4}]// with pagination// GET http://localhost/items?start=0&limit=3paginate;app;// will return 400 error if query limit > 100// {// "items": [{a:1, b:1}, {a:2, b:2}, {a:3, b:3}],// "prev": null,// "next": "http://localhost/items?start=3&limit=3"// }
License
MIT