Skip to content

Commit

Permalink
Documentation: Added additional parameters (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ričards Kalniņš authored Oct 29, 2020
1 parent 3aed229 commit ae0e9a5
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
- [Installation](#installation)
- [Getting started](#getting-started)
- [Query parameters](#query-parameters)
- [Special parameters](#special-parameters)
- [Additional parameters](#additional-parameters)
- [API documentation](API.md)

# Introduction
Expand Down Expand Up @@ -183,3 +185,22 @@ In addition to the filter parameters, there is a set of query parameters that ha
| `orderByDesc=firstName` | Sort the result by certain property in descending order. |
| `rangeStart=10` | The start of the result range (inclusive). The result will be `{total: 12343, results: [ ... ]}`. |
| `rangeEnd=50` | The end of the result range (inclusive). The result will be `{total: 12343, results: [ ... ]}`. |

## Additional parameters

Any query parameters, that are not listed in [Special parameters](#special-parameters), such as [page](https://vincit.github.io/objection.js/api/query-builder/other-methods.html#page), can be passed as query in second parameter.

```js
const findQuery = require('objection-find');

app.get('/persons', function (req, res, next) {
const { page, ...query } = req.query;

findQuery(Person)
.build(query, Person.query().page(page, 12))
.then(function (persons) {
res.send(persons);
})
.catch(next);
});
```

0 comments on commit ae0e9a5

Please sign in to comment.