Skip to content

createFetchHandler

function createFetchHandler<C>(options): CreateFetchHandlerResult<C>;

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

Build the panel fetch handler.

Type Parameter Default type
C extends AnyCatalog AnyCatalog
Parameter Type
options EntitlementsPanelOptions<C>

CreateFetchHandlerResult<C>

import { createFetchHandler } from "@xtandard/entitlements";
import { catalog } from "./catalog";
const { fetch, engine } = createFetchHandler({
catalog,
basePath: "/billing",
title: "Acme billing",
portal: { secret: process.env.PORTAL_SECRET! },
});
Bun.serve({ port: 3000, fetch });
// Elsewhere in the app:
await engine.consume("org_42", "api_calls");