Skip to content

This is a loopback 3 project that allows you to create a default set of filters for access endpoints

Notifications You must be signed in to change notification settings

Danwakeem/loopback-default-filter

Repository files navigation

Loopback Default Filter

Build Status Coverage Status

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,
  }
},

About

This is a loopback 3 project that allows you to create a default set of filters for access endpoints

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published