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