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

Dependencies (0)

    Dev Dependencies (26)

    Package Sidebar

    Install

    npm i express-batching

    Weekly Downloads

    4

    Version

    0.0.3

    License

    Apache-2.0

    Last publish

    Collaborators

    • blugavere