@button/divvy-client

1.0.1 • Public • Published

Divvy NodeJS Client

A client for the Divvy rate limit server.

  1. Requirements
  2. Usage
  3. Other Features
  4. License and Copyright

Requirements

  • NodeJS version 4 or newer.

Usage

const DivvyClient = require('@button/divvy-client');
const client = new DivvyClient('localhost', 8321);

client.hit({ method: 'GET', path: '/pantry/cookies' }).then((result) => {
    console.log(`Success: ${JSON.stringify(result)}`);
    // { allowed: true, currentCredit: 100, nextResetSeconds: 60 }
}).catch((err) => {
    console.log(`Error: ${err.message}`);    
});

Other Features

Client Stub

A stub of the interface is exposed as Client.Stub, which implements the core methods (connect, close, and hit).

License and Copyright

Licensed under the MIT license. See LICENSE.txt for full terms.

Copyright 2016 Button, Inc.

Readme

Keywords

none

Package Sidebar

Install

npm i @button/divvy-client

Weekly Downloads

10

Version

1.0.1

License

MIT

Last publish

Collaborators

  • it-admin-button
  • mike.wright
  • usebutton
  • ioswes
  • button-bot