Express.js middleware for idempotent request processing with Redis caching. Version 0.0.4, low activity. It stores request responses by an idempotency key header, ensuring that duplicate requests return the cached response without re-executing the handler. Useful for preventing duplicate processing in distributed systems. Differentiates by supporting all HTTP verbs and optional response parsing.
npm install express-idempotent-redisNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows minimal setup: create Express app, attach idempotency middleware with Redis client, and define a route that increments counter.
Set 'avoidParse: true' in request headers to get raw string response.
Ensure Redis client is connected and handle its 'error' event before using middleware.
Always send the header exactly as configured, e.g., 'IDEmpKey' (capitalization matters).
Use sleepTime large enough to allow first request to complete, but be aware of race conditions.
Set secondsToCache appropriately; cache cannot be cleared via API.
Use const idempotency = require('express-idempotent-redis'); (CommonJS).Start Redis server or provide correct REDIS_URL in client.createClient().
Run 'npm install express-idempotent-redis' (also ensure express and redis are installed).
Pass the result of redis.createClient() (or ioredis) as redisClient option.