Pipe validates request data before it reaches a controller route handler.
파이프는 요청 데이터가 라우트 핸들러에게 닿기 전에 검증을 한다. 적절한 데이터인지, 스트링으로 입력해야 하는데, 숫자로 입력하진 않았는 지 등의 검증을 한다.
It validates whether data that has to be a string is string or not.
UseGlobalPipes means that you tell Nest to use global validation.
Data transfer object(DTO) describes the different properties that the reequest body should have.
DTO is a class, and you should add validation rules to the class, and apply that class to the request handler(controller).
DTO carries data between two places(request and route handler). DTO determines whether it is suited for or not and if OK, dto carries it to the route handler. DTO sets rules that data has to be followed.
controller route the request to a particular function in services. Service handles some business logic. Service requests data needed for some logic to repository and then repository access the database to find the requested data.