express-paginate-bacon
v1.0.0
Published
Node.js pagination middleware and view helpers
Downloads
1
Maintainers
Readme
express-paginate-bacon
Node.js pagination middleware and view helpers. Based on https://github.com/expressjs/express-paginate, but everything is better with a bacon.
Install
npm install -S express-paginate-bacon
Usage
Just provide page=1 query parameter in the url.
API
var paginate = require('express-paginate-bacon');
paginate.middleware(perPage)
That's it. No other arguments required.
// # app.js
var express = require('express');
var paginate = require('express-paginate-bacon');
var app = express();
// Keep this before all routes that will use pagination.
app.use(paginate.middleware(100));
paginate.getPages(req)(resultsCount)
Get all the page urls.
paginate.slice(req)(data)
Slices data for the current page.
Frontend
paginate object is available in your template automagically.
- paginate.perPage
- paginate.offset
- paginate.skip
- paginate.start
- paginate.currentPage
- paginate.href