express-batching

0.0.3 • Public • Published

express-batching NPM version Build Status Dependency Status Coverage StatusNPM DownloadsPatreon

A small higher order component for in-process batching and caching of API requests

Installation

$ npm install --save express-batching

Usage

const expressBatching = require('express-batching');
const app = require('express')();
const catRoutes = require('./catRoutes');
 
// normal
app.get('/cats', catRoutes.findAll);
 
// with batching
app.get('/cats', expressBatching(catRoutes.findAll));
 
// accepting a hash function for parameterized requests
app.get('/cats/:id', expressBatching(req => req.params.id, catRoutes.findOne));
 

Contributing

Contribute!

TODOs

In order of importance

  • get a cool logo
  • optimize perf
  • config param
    • cache timeout
    • max queue size
  • setter injection for alternative cache (redis)
  • moar tests

Testing

mocha --require clarify lib/index.test.js --watch

License

Apache-2.0 © blugavere

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.3
    3
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.3
    3
  • 0.0.2
    0
  • 0.0.1
    0
  • 0.0.0
    0

Package Sidebar

Install

npm i express-batching

Weekly Downloads

3

Version

0.0.3

License

Apache-2.0

Last publish

Collaborators

  • blugavere