Skip to content

7주차 미션 [도토]#23

Open
yewon20804 wants to merge 16 commits into
mainfrom
week7/doto
Open

7주차 미션 [도토]#23
yewon20804 wants to merge 16 commits into
mainfrom
week7/doto

Conversation

@yewon20804
Copy link
Copy Markdown
Collaborator

Week7 미션

작업 내용

1. TSOA 도입 및 라우트 자동화

  • tsoa 설치
  • tsoa.json 설정 파일 추가
  • tsconfig.jsonexperimentalDecorators, emitDecoratorMetadata 추가
  • 기존 함수형 Express 핸들러 → TSOA 클래스 기반 Controller로 전환
  • index.ts: 수동 라우트 등록 → RegisterRoutes(router) + app.use("/api/v1", router) 구조로 변경

2. 공통 응답 형식 통일

  • 성공 응답: { resultType: "SUCCESS", error: null, data: T }
  • 실패 응답: { resultType: "FAILED", error: { errorCode, message, data }, data: null }
  • 각 DTO에 Response 타입 인터페이스 추가

3. 커스텀 에러 처리

  • AppError 클래스 추가
  • index.ts에 전역 에러 핸들러 미들웨어 등록
  • userSignUp 서비스에 DuplicateUserEmailError 적용

4. 미들웨어 추가

  • morgan — HTTP 요청 로깅
  • cookie-parser — 쿠키 파싱

@yewon20804 yewon20804 self-assigned this May 14, 2026
@yewon20804 yewon20804 added ✨ feature New feature or request ♻️ refactor labels May 14, 2026
@yewon20804 yewon20804 linked an issue May 14, 2026 that may be closed by this pull request
3 tasks
Copy link
Copy Markdown
Collaborator

@ywkim1m ywkim1m left a comment

Choose a reason for hiding this comment

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

다른 서비스 레이어에도 같은 방식으로 커스텀 에러 추가해주시면 좋겠습니다!

const store = await getStoreById(data.storeId);
if (!store) {
throw new Error("존재하지 않는 가게입니다.");
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

예외 처리 방식에 맞춰 StoreNotFoundError 같은 커스텀 에러를 사용하면 errorCode, statusCode, data까지 일관되게 관리할 수 있습니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Week7 mission

2 participants