Skip to content

createFetchHandler

function createFetchHandler(options): CreateFetchHandlerResult;

Defined in: src/server/create-fetch-handler.ts:160

Build the panel fetch handler.

Parameter Type
options AuditPanelOptions

CreateFetchHandlerResult

import { createFetchHandler, ed25519Signer } from "@xtandard/audit";
import { createMemoryStorage } from "@xtandard/audit/storage/memory";
const { fetch, core } = createFetchHandler({
storage: createMemoryStorage(),
basePath: "/audit",
title: "Acme Audit Log",
signer: await ed25519Signer(JSON.parse(process.env.AUDIT_SIGNING_KEY!)),
retention: { maxAge: "365d" },
});
Bun.serve({ port: 3000, fetch });
// Elsewhere in the app:
await core.record({ tenant: "acme", action: "invoice.paid", actor: { id: "user_1" } });