Skip to content

@xtandard/entitlements/express

Express adapter: entitlementsPanel() bridges Node’s req / res to the web-standard panel handler (mount it before any body parser), and requireEntitlement() is a guard middleware setting req.entitlement.

import { … } from "@xtandard/entitlements/express";
Name Summary
entitlementsPanel Create an Express handler serving the panel. Use with app.use(path, handler).
requireEntitlement Express middleware guarding a route with an entitlement (ADR 0009): 402 / 403 JSON for denials, 401 without a customer; otherwise sets req.entitlement (and res.locals.entitlement) and calls next().
Name Summary
EntitlementRequest An Express request carrying the guard’s decision.
ExpressEntitlementsHandler An Express request handler with the panel’s engine + openapi attached.
Name Documented on
EntitlementsPanelOptions @xtandard/entitlements
RequireEntitlementOptions @xtandard/entitlements