1.0.4 • Published 7 years ago
loopback-max-result-mixin v1.0.4
RESULTSET LIMIT
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
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": {
"MaxResult": {
"limit": 100
}
}
}
TESTING
Run the tests in test.js
npm test
Run with debugging output on:
DEBUG='loopback-ds-resultset-limit-mixin' npm test