Express middleware for masking sensitive data in API responses, built on maskdata. Version 0.1.1 (latest), stable but early stage. Released irregularly. Differentiates by integrating maskdata into Express with simple rule-based configuration for common fields like email, password, phone, SSN, credit card. Supports TypeScript out of the box. Minimal footprint; only dependency is maskdata. Ideal for protecting PII in response bodies without manual transformation.
npm install express-maskdata-middlewareNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initializes an Express app, creates masking middleware with rules for email and password, and applies to all routes. The /user endpoint returns JSON with sensitive fields automatically masked.
Use express.json() and ensure res.json() is used for responses you want masked.
Flatten or preprocess nested objects, or use maskdata directly for complex structures.
Implement custom masking for arrays if needed, or ensure array elements are processed individually.
Use the exact npm name: `express-maskdata-middleware`.
Use named import: import { createMaskingMiddleware } from 'express-maskdata-middleware'.Run: npm install express-maskdata-middleware --save
Ensure all used fields are defined in the rules object, or use type assertion: createMaskingMiddleware(rules as MaskingRules).