# node-paginate-anything

> Node server side for the angular-paginate-anything directive. Modify the http response for pagination, return 2 properties to use in a query

Latest version **1.0.0** (published 2017-01-01) · 0 weekly downloads

## Install

```sh
npm install node-paginate-anything
pnpm add node-paginate-anything
yarn add node-paginate-anything
bun add node-paginate-anything
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-01-01 |
| First published | 2014-06-29 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 17 |
| Maintainers | polo2ro |

## Links

- npm: https://www.npmjs.com/package/node-paginate-anything
- Repository: https://github.com/polo2ro/node-paginate-anything
- Homepage: https://github.com/polo2ro/node-paginate-anything#readme
- Issues: https://github.com/polo2ro/node-paginate-anything/issues
- npm.io page: https://npm.io/package/node-paginate-anything

## Recent versions

- 1.0.0 (latest) — 2017-01-01
- 0.0.5 — 2014-08-23
- 0.0.4 — 2014-08-03
- 0.0.3 — 2014-08-01
- 0.0.1 — 2014-06-29

## README

node-paginate-anything
======================

[![Build Status](https://travis-ci.org/polo2ro/node-paginate-anything.svg?branch=master)](https://travis-ci.org/polo2ro/node-paginate-anything)
[![Dependency Status](https://david-dm.org/polo2ro/node-paginate-anything.svg)](https://david-dm.org/polo2ro/node-paginate-anything)
[![devDependency Status](https://david-dm.org/polo2ro/node-paginate-anything/dev-status.svg)](https://david-dm.org/polo2ro/node-paginate-anything#info=devDependencies)

nodejs server side module for [angular-paginate-anything](https://github.com/begriffs/angular-paginate-anything)

This nodejs module add the required headers in the http response to paginate the items. This is a rewrite of [clean_pagination](https://github.com/begriffs/clean_pagination)


### Install
```Bash
  npm install node-paginate-anything
```

### Usage

```JavaScript
  var paginate = require('node-paginate-anything');
  
  var queryParameters = paginate(ClientRequest, ServerResponse, totalItems, maxRangeSize);
  
  mongooseQuery.limit(queryParameters.limit);
  mongooseQuery.skip(queryParameters.skip);
```



parameter      | Description
---------------|---------------
ClientRequest  | [clientRequest](http://nodejs.org/api/http.html#http_class_http_clientrequest) object from the native http module or from an express app. 
ServerResponse | [ServerResponse](http://nodejs.org/api/http.html#http_class_http_serverresponse) object to modify before sending the http response.
totalItems     | total number of items in the result set.
maxRangeSize   | angular-paginate-anything send is own requested range in the request, this parameter specify the maximum value.


### Benefits

* **HTTP Content-Type agnoticism.** Information about total items,
  selected ranges, and next- previous-links are sent through headers.
  It works without modifying your API payload in any way.
* **Graceful degredation.** Both client and server specify the maximum
  page size they accept and communication gracefully degrades to
  accomodate the lesser.
* **Expressive retrieval.** This approach, unlike the use of `per_page` and
  `page` parameters, allows the client to request any (possibly unbounded)
  interval of items.
* **Semantic HTTP.** Built in strict conformance to RFCs 2616 and 5988.

---
_Source: https://npm.io/package/node-paginate-anything · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
