Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fullcube/loopback-ds-resultset-limit-mixin

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RESULTSET LIMIT

Greenkeeper badge

Circle CI Coverage Status Dependencies semantic-release

This module is designed for the Strongloop Loopback framework. It provides a mixin that makes it possible to limit the number of results returned from an API query.

This works in a similar way to a default scope - the difference being that it acts as a maximum limit constraint ensuring that no more results than the configured maximum will be served by the api, even if requested.

This affects remote remote API calls only and does not apply to internal usage of the API.

INSTALL

npm install --save loopback-ds-resultset-limit-mixin

Then you should register the mixin in your app by adding ../node_modules/loopback-ds-resultset-limit-mixin/lib to the mixins property to your server/model-config.json like the following:

{
  "_meta": {
    "sources": [
      "loopback/common/models",
      "loopback/server/models",
      "../common/models",
      "./models"
    ],
    "mixins": [
      "loopback/common/mixins",
      "../node_modules/loopback-ds-resultset-limit-mixin/lib",
      "../common/mixins"
    ]
  }
}

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": {
      "ResultsetLimit": {
        "limit": 100
      }
    }
  }

TESTING

Run the tests in test.js

  npm test

Run with debugging output on:

  DEBUG='loopback:mixin:resultset-limit' npm test

About

A mixin to provide resultset limiting for loopback

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.