CodeZettaInterview Hub

NestJS · Controllers · Senior · Debugging

Scenario: controller returns entities with password hashes. Fix?

Short Interview Answer

Never return ORM entities directly — map to response DTOs/serializers and exclude sensitive fields.

Detailed Explanation

class-serializer interceptors help but explicit mappers are clearer. Add tests that fail on sensitive keys.

Did you know this answer?