loopback-default-filter

1.0.1 • Public • Published

Loopback Default Filter

This loopback middleware adds a default filter to requests that accept a query

Useage

Install

npm i loopback-default-filter --save

Integrate with Loopback

Include the mixin in your model-config.json file

{
  "mixins": [
    "../node_modules/loopback-default-filter"
  ]
}

Then add the mix in to your model.json file

"mixins"{
  "DefaultFilter": {
    "limit": 10,
    "offset": 0
  }
},

Options

I know there is supposed to be a way to do this through the loopback scope but it had some strange behavior so I just made a mixin to fix this

You can put whatever where filter you want in the mixin opitons

"mixins"{
  "DefaultFilter": {
    "where": {
      "field": 10,
    },
    "offset": 100,
    "limit": 20,
  }
},

Readme

Keywords

Package Sidebar

Install

npm i loopback-default-filter

Weekly Downloads

0

Version

1.0.1

License

ISC

Unpacked Size

5.07 kB

Total Files

7

Last publish

Collaborators

  • danwakeem