paginationMiddleware
SourceMiddleware to activate pagination on an endpoint.
This should not be added globally. It should be added to each Endpoint that requires pagination.
Usage:
new Endpoint(new UrlPattern('/users/'), {middleware: [paginationMiddleware()]})
Or to customise the paginatorClass
new Endpoint(new UrlPattern('/users/'), {middleware: [paginationMiddleware(PageNumberPaginator)]})
Parameter | Type | Description | |
---|---|---|---|
* | paginatorClass | PaginatorInterfaceClass | The pagination class to use. Defaults to InferredPaginator. |
options.getPaginationState | Function | Function that returns the state for a paginator based on the response. If not provided
uses the static | |
options.resultPath | string | Optional path to where in data the pagination state exists. Dotted notation is accepted (see below example). If this is provided only this section of the data object will be updated. For example if the return data looked like:
And
|
Key | Type | Description |
---|---|---|
init | Function | |
prepare | Function | |
process | Function |