Framework guides
Express

Express (NodeJS)

Just install the module, and add it to your route(s).

Install

Install the middleware from NPM

Add it to your route(s)

app.ts
import {rerunnable} from "@rerun/express";
 
// simply add the rerunnable middleware to any route
app.post('/hello', rerunnable, (req:any, res:any) => {
  res.send(`Hello ${req.query.name}!`);
});

Sub-routers

If you use an express sub-routers, use rerunnableRoute to tell rerun where to find it. This just needs to be called once (per router). Put this near the top (above any routes).

my-route.ts
import { rerunnable, rerunnableRoute } from "../rerunnable";
 
const router = require('express').Router();
router.use(rerunnableRoute("/my-route")); // path for requests, e.g. "{SERVER_URL}/my-route"
 
router.post('/biscuits/:type', rerunnable, (req:any, res:any) => {
  res.send('Hello ! ' + req.params.type);
});

Custom port or baseUrl

By default, rerun uses http://localhost:3000 as the root server URL to replay requests.

If you are using a different port, use the baseUrl setting in the Visual Studio Code extension settings. E.g. if you're using port 8080, set the baseUrl to http://localhost:8080.

Advanced options:

  • If you want a shared library or rerunnable requests which is automatically synchronized with all your team, add Rerun Team.
  • If you want to use rerun to replicate actual user requests (e.g. to recreate & debug user issues, test with real requests, etc.), add Rerun Replicate.