PAGINATION
This module is designed for the Strongloop Loopback framework. It provides a mixin that makes it easy to add paginate to an existing model
INSTALL
npm install --save loopback-ds-paginate-mixin
SERVER CONFIG
Add the mixins property to your server/model-config.json:
{
"_meta": {
"sources": [
"loopback/common/models",
"loopback/server/models",
"../common/models",
"./models"
],
"mixins": [
"loopback/common/mixins",
"../node_modules/loopback-ds-paginate-mixin/lib",
"../common/mixins"
]
}
}
MODEL CONFIG
To use with your Models add the mixins
attribute to the definition object of your model config.
USAGE
// The basicvar request = skip: 0 limit: 15 where: status: 'active' // Using a PromiseItem; // Using a callbackItem; // You can override the limit on a per-request basevar options = limit: 5Item;
TESTING
Run the tests in test.js
npm test
Run with debugging output on:
DEBUG='loopback-ds-paginate-mixin' npm test