# @openquantum/honey-pager

> A Relay-style cursor pagination tool for mongoose schema.

Latest version **0.2.8** (published 2022-07-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install @openquantum/honey-pager
pnpm add @openquantum/honey-pager
yarn add @openquantum/honey-pager
bun add @openquantum/honey-pager
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.8 |
| Published | 2022-07-20 |
| First published | 2021-07-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=12.0.0 |
| Dependencies | 6 |
| Unpacked size | 49.8 KB |
| Known vulnerabilities | 0 (+3 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Louis Bodart |
| Maintainers | openquantum |

## Links

- npm: https://www.npmjs.com/package/@openquantum/honey-pager
- Repository: https://github.com/codeinbrain/honey-pager
- Homepage: https://github.com/codeinbrain/honey-pager#readme
- Issues: https://github.com/codeinbrain/honey-pager/issues
- npm.io page: https://npm.io/package/@openquantum/honey-pager

## Dependencies (6)

- [debug](https://npm.io/package/debug.md) ^4.3.4
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [graphql](https://npm.io/package/graphql.md) ^16.5.0
- [validator](https://npm.io/package/validator.md) ^13.7.0
- [base64-url](https://npm.io/package/base64-url.md) ^2.3.3
- [jsonwebtoken](https://npm.io/package/jsonwebtoken.md) ^8.5.1

## Recent versions

- 0.2.8 (latest) — 2022-07-20
- 0.2.7 — 2022-02-23
- 0.2.5 — 2021-08-12
- 0.2.0 — 2021-07-13

## README

Fork from https://github.com/codeinbrain/honey-pager that uses Base64 instead of JWT.

<p align="center">
  <img src="https://github.com/codeinbrain/honey-pager/blob/master/docs/honeypager.png" width="700" title="HoneyPager">
</p>

<p align="center">
  <a href="https://travis-ci.org/codeinbrain/honey-pager"><img src="https://img.shields.io/travis/codeinbrain/honey-pager.svg" title="Travis (.org)"></a>
  <img src="https://img.shields.io/badge/status-experimental-orange.svg" title="Status">
</p>

A [Relay-style](https://facebook.github.io/relay/graphql/connections.htm) cursor pagination tool for [mongoose](https://github.com/Automattic/mongoose) schema. Designed to work with GraphQL.

## Quick view

```javascript
// User.js
import mongoose, { Schema } from 'mongoose';
import { honeypager } from 'honey-pager';

const schema = Schema({
  firstName:  { type: String },
  lastName:   { type: String },
  email:      { type: String }
});

schema.plugin(honeypager);

export default schema;
```

```javascript
// server.js
import express from 'express';
import User from './User';

let app = express();
// ...
app.get('/users', (req, res) => {
  const result = User.paginateResult();
  res.status(200).json(result);
});
```
This will gives you the following response:
```
{
  "totalCount": 10,
  "edges": [
    {
      "cursor": "...",
      "node": {
        "firstName": "John",
        "lastName": "Doe",
        "email": "jdoe@test.com"
      }
    },
    ...
  ],
  "pageInfo": {
    "startCursor": "...",
    "endCursor": "...",
    "hasNextPage": false,
    "hasPreviousPage": false
  }
}
```

Made with :heart: by [lobodart](https://github.com/lobodart).

---
_Source: https://npm.io/package/@openquantum/honey-pager · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
