createFetchHandler
function createFetchHandler<C>(options): CreateFetchHandlerResult<C>;Defined in: src/server/create-fetch-handler.ts:148
Build the panel fetch handler.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
C extends AnyCatalog |
AnyCatalog |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options |
EntitlementsPanelOptions<C> |
Returns
Section titled “Returns”Example
Section titled “Example”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");