New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hapi-paginate

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-paginate

A pagination plugin for Hapi

  • 0.4.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-75%
Maintainers
2
Weekly downloads
 
Created
Source

hapi-paginate

npm version Build Status

A basic pagination plugin for Hapi.

The plugin listens to page and limit query parameters and add them to request object.

The Hapi app should decide how to handle request.page and request.limit values.

The plugin then adds a meta key to the output json response and move the response under results key.

To limit the plugin to specific routes, adds routes to options.

Example

curl -X GET http://www.example.com?page=3&limit=100

{
    "meta": {
        "page": 3,
        "limit": 100
    },
    "results": {
        "key": "value"
    }
}

Installation

$: npm install hapi-paginate

Registration

var Hapi = require('hapi');

var hapi = new Hapi.Server();
hapi.connection();

hapi.register({
  register: require('hapi-paginate'),
  options: {
    limit: 1000,
    name: 'My Meta',
    results: 'output',
    routes: ['/', '/api']
  }
};

Test

$ npm test

Keywords

FAQs

Package last updated on 14 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc