Open
Description
I have this following code:
@JsonController('/auth')
@Service()
export class AuthController {
constructor(private readonly authService: AuthService) {}
@Post('/register')
@HttpCode(201)
@Serialize(UserDto)
async registerUser (@Body() body: RegisterDto) {
console.log(body)
return this.authService.register(body.toJson());
}
}
As you can see the controller is using validation.
After I call the api endpoint, the console outputs RegisterDto { username: 'test', password: 'test' }
.
Coming from a nestjs perspective, it would automatically convert this dto instance to a plain object, and the console would output this { username: 'ermal1', password: 'dasd' }
.
How can i achieve this using routing-controllers ?