// Controller 계층
@PostMapping("/shorten")
fun shortenUrl(
@RequestBody request: ShortenUrlRequest
): ShortenUrlResponse {
val input = request.toInput()
val output = shortenUrlService.shortenUrl(input)
return ShortenUrlResponse.from(output)
}
// Service 계층
fun shortenUrl(input: ShortenUrlInput): ShortenUrlOutput {
val shortenUrl = generateShortenUrl(input)
return ShortenUrlOutput(
shortUrl = shortenUrl
)
}
이런 코드를 습관적으로 작성하고 있다.
Request
, Response
로Input
, Output
으로