README
Express.js Request Queue
Uses stack and Async/Await approach
Use this for your express routes if you need those concurrent requests to behave in sequence. If you don't need every request to be queued, set a config and specify your unique identifier to group the queues.
Installation
> npm install express-request-queue --save
Usage
import RequestQ from 'express-request-queue';
const q = RequestQ();
route.post('/book', q.run(async (req, res, next) {
await longRunningTask();
res.json({});
}));
Group queues
Grouping queues base on your request payload:
const config = {
unique: true, // by setting this to true, queues are grouped by thier identifiers
from: 'body', // what type of req payload the identifier is located from
name: 'id' // name of the field to reference from
}
const q = RequestQ(config);
License
MIT