This package provides an Express middleware to capture failed requests and retry them automatically. It also provides a service to replay failed requests.
- Capture and store failed requests.
- Automatically replay failed requests
Install the package via npm:
npm install replay-api
- Apply the middleware globally
import { requestReplayMiddleware } from 'replay-api';
app.use(requestReplayMiddleware);
- Apply the middleware to specific routes
app.post('/api/test-endpoint', requestReplayMiddleware, (req, res) => {
// Route logic
});
import { replayFailedRequests } from 'replay-api';
replayFailedRequests({ retryLimit: 5 }); // you should configure your retry limit tho