0.0.3 • Published 7 years ago

express-batching v0.0.3

Weekly downloads
2
License
Apache-2.0
Repository
github
Last release
7 years ago

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