ValidationPipe1 [Nest JS] useGlobalPipes 설정하기 -main.ts app.useGlobalPipes( new ValidationPipe({ whitelist: false, //DTO에 정의되지 않은 속성은 자동제거, 에러메세지 출력 forbidNonWhitelisted: false, //DTO에 존재하지않는 값이 들어오면 에러메세지 출력 transform: true, //DTO에 설정 타입은 striing이지만 number로 타입 변형 가능하게 설정 transformOptions: { enableImplicitConversion: true, //문자열에서 숫자, 불리언 또는 배열로의 암시적 변환이 가능 }, }), ); 웹 애플리케이션으로 전송된 모든 데이터의 정확성을 검증하기 위한 파이프이다. ValidationPipe 는 강력한 클래스 유효성 검사기.. 2024. 4. 15. 이전 1 다음 728x90 반응형