foxify-restify-odin
Easily restify odin databases
Table on Contents
Getting Started
Prerequisites
- Node.js
8.12
or higher is required. - foxify
0.10.20
or higher is required. - @foxify/odin
0.8.0
or higher is required.
Installation
npm i -s foxify-restify-odin
Usage
const Foxify = ;const restify = ;const User = ; let app = ; app; appstart;
Documentation
; restifymodel: typeof Odin, options: Partial<restify.Options> = : Router;
This module's middleware parses url query string and executes a query on the given model accordingly and passes the query
to you (since you might need to do some modifications on the query, too)
It also passes a counter
which is exactly like query
but without applying skip
, limit
, sort
just because you might want to send a total count in your response as well
Lastly it passes the a decoded
key in req.fro
which is the parsed query string that is used in the middleware
Stringify all query params using qs default options
All the possible query modifiers are explained as a single modification but they all can be used together
/users?sort%5B0%5D=age
Filters
qs
qs
filter can be a single filter object or and
/or
of Array<filter object>
possible operators:
lt
| lte
| eq
| ne
| gte
| gt
| exists
| in
| nin
| bet
| nbe
| like
| nlike
include
qs
sort
qs
skip
qs
limit
qs
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Authors
- Ardalan Amini - Owner/Developer - @ardalanamini
See also the list of contributors who participated in this project.
License
This project is licensed under the MIT License - see the LICENSE file for details
Support
If my work helps you, please consider