{"repo":"TRUEPIC/queryql","free":true,"listed":false,"github":"https://github.com/TRUEPIC/queryql","clone":"git clone https://github.com/TRUEPIC/queryql.git","description":"Easily add filtering, sorting, and pagination to your Node.js REST API through your old friend: the query string!","language":"JavaScript","stars":123,"topics":["filter","filtering","sort","sorting","page","pagination","rest","query","querystring","qs"],"license":"MIT","category":"data-pipelines","readme_excerpt":"QueryQL QueryQL makes it easy to add filtering, sorting, and pagination to your Node.js REST API through your old friend: the query string! Read our introductory article to learn more about why we wrote it and the problems it solves at Truepic. QueryQL works with any Node.js web framework (be it Express, Koa, etc.), supports any query builder / ORM through adapters , and allows for custom validators so you can define validation in a familiar way. Out of the box, QueryQL supports the following: - Adapter: Knex (works with Objection.js and other ORMs that use Knex) - Validator: Joi Installation Getting Started 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 module does not , but a package like qs does. It's usually a simple config change to switch.) Let's consider an example to illustrate: To support this query, QueryQL only requires you to define (whitelist) what's allowed through what we call a querier . Here's how one might look for the /images endpoint: With your querier defined, you can now call it in your router / controller. Here's how it might look in an Express route: Behind-the-scenes, QueryQL takes your initial query builder ( knex('images') ), and applies the following Knex chain when querier.run() is cal","default_branch":null,"files":null,"tree":[],"storefront":"/r/TRUEPIC","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/TRUEPIC/queryql/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}