Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wejs/we-plugin-search
Automaticaly add suport for use url query params as database query where params in findAll actions.
https://github.com/wejs/we-plugin-search
api search wejs
Last synced: about 1 month ago
JSON representation
Automaticaly add suport for use url query params as database query where params in findAll actions.
- Host: GitHub
- URL: https://github.com/wejs/we-plugin-search
- Owner: wejs
- Created: 2016-11-05T21:06:22.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-23T19:27:33.000Z (almost 2 years ago)
- Last Synced: 2024-10-05T16:10:46.197Z (3 months ago)
- Topics: api, search, wejs
- Language: JavaScript
- Homepage:
- Size: 816 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# We.js api search plugin
Automaticaly add suport for use url query params as database query where params in findAll actions.
## Installation
```js
we i we-plugin-search
```## Example:
For model bellow:
server/models/post.json:
```json
{
"attributes": {
"title": {
"type": "string",
"allowNull": false
},
"title": {
"type": "string",
"allowNull": false
},
"body": {
"type": "text"
},
"category": {
"type": "string",
"defaultValue": null
},
"comments": {
"type": "INTEGER",
"defaultValue": 0
},
"published": {
"type": "boolean",
"defaultValue": false
}
}
}
```Will accept this query params as filters:
- 'get /post?id=[id]'
- 'get /post?id_equal=[id]'
- 'get /post?id_is-null=true'
- 'get /post?id_is-null=true'
- 'get /post?id_not-is-null=true'
- 'get /post?id_between=10-20'
- 'get /post?id_not-between=10-30'
- 'get /post?id_gt=2'
- 'get /post?id_gte=2'
- 'get /post?id_lt=20'
- 'get /post?id_lte=20'
- 'get /post?title=Oi mundo'
- 'get /post?title_equal=Oi mundo'
- 'get /post?title_is-null=true'
- 'get /post?title_not-is-null=true'
- 'get /post?title_starts-with=Oi'
- 'get /post?title_not-starts-with=Oi'
- 'get /post?title_ends-with=Mundo'
- 'get /post?title_not-ends-with=Mundo'
- 'get /post?title_contains=Mundo'
- 'get /post?title_not-contains=Mundo'
- 'get /post?body=Something'
- 'get /post?body_equal=Something'
- 'get /post?body_equal=Something'... see all query params in: https://github.com/wejs/we-plugin-search/blob/master/plugin.js#L15
@TODO list all query params generated here
## Links
* We.js site: http://wejs.org
## License
[MIT license](https://github.com/wejs/we-core/blob/master/LICENSE.md).
## Sponsored by
- Linky: https://linkysystems.com