Skip to content

Commit

Permalink
Add docs about parsing nested qs objects
Browse files Browse the repository at this point in the history
Fixes #44
  • Loading branch information
jstayton committed Nov 11, 2021
1 parent 12506d4 commit 15b6622
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ To run a querier, start by creating a new instance of one:
const querier = new UserQuerier(query, builder, (config = {}))
```

- `query` is a parsed query string, like Express' `req.query`.
- `query` is a parsed query string, like Express' `req.query`. (Make sure your
framework uses a query string parser that supports nested objects. Node.js's
native [`querystring`](https://nodejs.org/api/querystring.html) module _does
not_, but a package like [qs](https://github.com/ljharb/qs) does. It's usually
a simple config change to switch.)
- `builder` is a query builder / ORM object that the configured adapter works
with, like Knex.
- `config` is an optional instance-specific config that overrides the global
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ QueryQL takes a parsed query string (like Express' `req.query`) and translates
it into the appropriate function calls that your query builder / ORM understands
to filter, sort, and paginate the records.

(Make sure your framework uses a query string parser that supports nested
objects. Node.js's native
[`querystring`](https://nodejs.org/api/querystring.html) module _does not_, but
a package like [qs](https://github.com/ljharb/qs) does. It's usually a simple
config change to switch.)

Let's consider an example to illustrate:

```
Expand Down

0 comments on commit 15b6622

Please sign in to comment.