Skip to content

requireEntitlement

function requireEntitlement<C>(
engine,
feature,
options
): (req, res, next) => void;

Defined in: src/adapters/express.ts:76

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().

Type Parameter
C extends AnyCatalog
Parameter Type
engine Entitlements<C>
feature FeatureKey<C>
options RequireEntitlementOptions<Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>>

(req, res, next) => void