How can I expose all properties in an entity using @Expose decorator from class-transformer?

Viewed 336

I used class-transformer lib to my proyect implemented on NodeJS, but i did not find a way to expose all my properties of my entity, I try using de @Expose() decrator at class level, but it does not work,I hope find similar solution because is a little exhausting del expose decorator one by one property in my entity. example of what I desire:

@Expose()
export class User{
   name:string;
   phone:string;
   age:number
};

by currently it just work if:

export class User{
   @Expose()  name:string;
   @Expose()  phone:string;
   @Expose()  age:number
};
0 Answers
Related