feathers-iterate
v1.0.1
Published
Adds a .iterate() method to services in Feathers.js
Downloads
2
Maintainers
Readme
feathers-iterate
Adds a .iterate()
method to services in Feathers.js
.iterate()
creates an async genarator for the find method on the service using given params which can be iterated using for await...of
Install
npm install feathers-iterate --save
or
yarn add feathers-iterate
Configure on server and client
const iterate = require('feathers-iterate')
app.configure(itereate())
Note: you must configure feathers-iterate before any services are registered.
Use
const genrator = app.service('messages').iterate({/* params */})
for await (let message of generator) {
// do something with data
}
For pagination iterate
uses params.query.$skip
and params.query.$limit
.
Next page is called when total > $limit + $skip
with new skip as $limit + $skip
.