createFetchHandler
function createFetchHandler(options): CreateFetchHandlerResult;Defined in: src/server/create-fetch-handler.ts:160
Build the panel fetch handler.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options |
AuditPanelOptions |
Returns
Section titled “Returns”Example
Section titled “Example”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" } });