Skip to content

CrearAyT/loopback-ds-paginate-mixin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.JS

In your server/server.js file add the following line before the boot(app, __dirname); line.

...
var app = module.exports = loopback();
...
// Add Readonly Mixin to loopback
require('loopback-ds-paginate-mixin')(app);

boot(app, __dirname, function(err) {
  'use strict';
  if (err) throw err;

  // start the server if `$ node server.js`
  if (require.main === module)
    app.start();
});

CONFIG

To use with your Models add the mixins attribute to the definition object of your model config.

{
    "name": "Item",
    "properties": {
        "name": "String",
        "description": "String",
        "status": "String"
    },
    "mixins": {
        "Paginate": {
            "config": {
                "limit": "10"
            }
        }
    }
}

TESTING

Run the tests in test.js

  npm test

Run with debugging output on:

  DEBUG='loopback-ds-paginate-mixin' npm test

About

A mixin to provide pagination for loopback Model properties

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%