Skip to content

[1주차] 최유찬/[feat] 초기 프로젝트 설정 #40

Merged
ruchan04 merged 2 commits intoLeets-Official:최유찬/mainfrom
ruchan04:최유찬/1주차
Mar 26, 2026

Hidden character warning

The head ref may contain hidden characters: "\ucd5c\uc720\ucc2c/1\uc8fc\ucc28"
Merged

[1주차] 최유찬/[feat] 초기 프로젝트 설정 #40
ruchan04 merged 2 commits intoLeets-Official:최유찬/mainfrom
ruchan04:최유찬/1주차

Conversation

@ruchan04
Copy link
Copy Markdown

1. 과제 요구사항 중 구현한 내용

  • 프로젝트 구조 구성 (Controller/Service 레이어 분리)
  • 헬스체크 API 구현 (GET /health)
  • 문자열 2개 반환 API 구현 (POST /string/repeat)
  • 권장 추가 구현 반영 (선택)

2. 핵심 변경 사항

Layered Architecture 적용: ApiController와 ApiService로 역할을 분리하여 유지보수성을 높였습니다.

API 경로 통일: 모든 API 엔드포인트를 /api/test/ 하위로 구성하여 가독성을 개선했습니다.

예외 처리 도입: DTO 수준에서 @NotNull Validation을 추가하여 value가 없을 경우 COMM_400 에러가 반환되도록 설정했습니다.

3. 실행 및 검증 결과

  • GET /health 응답:
health 결과
  • POST /string/repeat 요청/응답:
리츠post

실행 결과: Tomcat started on port 8080 확인 및 정상 작동

GET /api/test/health 응답:

JSON
{ "isSuccess": true, "code": "TEST_200", "message": "OK" }
POST /api/test/repeat 요청/응답:

요청: {"value": "hello"}

응답:

JSON
{ "isSuccess": true, "code": "TEST_201", "message": "성공", "data": { "string_one": "hello", "string_two": "hello" } }

4. 완료 사항

  1. 요청/응답 DTO 분리 및 공통 응답 규격 적용

  2. 잘못된 요청(Null)에 대한 Validation 예외 처리 구현

  3. Controller - Service 레이어 분리 및 의존성 주입(@requiredargsconstructor) 적용

5. 추가 사항

관련 이슈: closed #16

제출 체크리스트

  • PR 제목이 규칙에 맞다
  • base가 {이름}/main 브랜치다
  • compare가 {이름}/{숫자}주차 브랜치다
  • 프로젝트가 정상 실행된다
  • 본인을 Assignee로 지정했다
  • 파트 담당 Reviewer를 지정했다
  • 리뷰 피드백을 반영한 뒤 머지/PR close를 진행한다

Reviewer 참고

@ruchan04 ruchan04 self-assigned this Mar 24, 2026
@ruchan04 ruchan04 requested a review from a team March 24, 2026 14:52

@RestController
@RequiredArgsConstructor
public class ApiController {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코드 작성하시느라 고생하셨습니다😄 하지만 ApiController, 하나의 컨트롤러에서 헬스체크와 문자열 반복이라는 두가지 책임을 동시에 가짐에 있어서 SRP(단일책임원칙)과 잘 맞지 않은 것 같습니다. HealthController와 RepeatController로 나누어 각각 한 가지 책임을 위임하는 방식으로 리팩토링하시면 더 좋은 코드가 될 것 같습니다❗

import org.springframework.stereotype.Service;

@Service
public class ApiService {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

현재 ApiService로 되어있는데 문자열 반복 서비스인만큼 서비스 네이밍도 그에 맞춰서 작성하시면 더욱 좋을 것 같습니다! 💊

@@ -0,0 +1,10 @@
package com.example.demo1.dto;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DTO 활용해서 요청/응답을 명확하게 잘 분리하신 것 같고, 입력값 검증과 예외 처리 부분 읽어보면서 많이 배웠습니다. 미션 진행하시느라 고생 많으셨습니다!

Copy link
Copy Markdown

@yeonjuncho yeonjuncho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💊
.gradle/, .idea/, build/, .class 같은 로컬 빌드 산출물이 많이 포함되어 있는 것 같습니다. 이 부분 수정이외에는 좋은 것 같습니다. 고생하셨습니다!

@ruchan04 ruchan04 merged commit 008b25a into Leets-Official:최유찬/main Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants