Skip to content

This package provides an Express middleware to capture failed api requests and retry them automatically.

License

Notifications You must be signed in to change notification settings

kalebalebachew/API-replay

Repository files navigation

Replay-API

This package provides an Express middleware to capture failed requests and retry them automatically. It also provides a service to replay failed requests.

Features

  • Capture and store failed requests.
  • Automatically replay failed requests

Installation

Install the package via npm:

npm install replay-api

Example Usage

Applying the middleware

  • 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
});

Replaying failed requests

import { replayFailedRequests } from 'replay-api';

replayFailedRequests({ retryLimit: 5 }); // you should configure your retry limit tho

About

This package provides an Express middleware to capture failed api requests and retry them automatically.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published