Skip to content

auditContext

function auditContext(options?): (req, res, next) => void;

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

Request-context middleware: resolves the actor / tenant from Express’s req (whatever your auth middleware set, e.g. req.user) and calls next() inside an audit context scope, so every audit.record() in the downstream handlers is attributed. The socket address is the IP fallback.

Parameter Type
options? AuditContextOptions<Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>>

(req, res, next) => void