Skip to content

createFetchHandler

function createFetchHandler(options): CreateFetchHandlerResult;

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

Build the panel fetch handler.

Parameter Type
options WebhooksPanelOptions

CreateFetchHandlerResult

import { createFetchHandler } from "@xtandard/webhooks";
import { createFileStorage } from "@xtandard/webhooks/storage/file";
const storage = createFileStorage({ dir: "./data/webhooks" });
const { fetch, core } = createFetchHandler({
storage,
basePath: "/webhooks",
title: "Acme Webhooks",
});
Bun.serve({ port: 3000, fetch });
// Elsewhere in the app:
await core.publish("acme", { eventType: "invoice.paid", payload: { id: "inv_1" } });