Skip to content

Scheduling infrastructure for absolutely everyone.

343 B
Raw Blame
import { middleware } from "../trpc";

const perfMiddleware = middleware(async ({ path, type, next }) => {
  performance.mark("Start");
  const result = await next();
  performance.mark("End");
  performance.measure(`[${result.ok ? "OK" : "ERROR"}][$1] ${type} '${path}'`, "Start", "End");
  return result;
});

export default perfMiddleware;