Skip to content

Conversation

@De-cal
Copy link
Collaborator

@De-cal De-cal commented Jun 20, 2025

요구사항

기본 요구사항

공통

  • Github에 위클리 미션 PR을 만들어 주세요.
  • React 및 Express를 사용해 진행합니다.
  • TypeScript를 활용해 프로젝트의 필요한 곳에 타입을 명시해 주세요.
  • any 타입의 사용은 최소화해 주세요.
  • 복잡한 객체 구조나 배열 구조를 가진 변수에 인터페이스 또는 타입 별칭을 사용하세요.
  • Union, Intersection, Generics 등 고급 타입을 적극적으로 사용해 주세요.
  • 타입 별칭 또는 유틸리티 타입을 사용해 타입 복잡성을 줄여주세요.
  • 타입스크립트 컴파일러가 에러 없이 정상적으로 작동해야 합니다.

프론트엔드

  • 기존 React(혹은 Next) 프로젝트를 타입스크립트 프로젝트로 마이그레이션 해주세요.
  • TypeScript를 활용해 프로젝트의 필요한 곳에 타입을 명시해 주세요.

백엔드

  • 기존 Express.js 프로젝트를 타입스크립트 프로젝트로 마이그레이션 해주세요.
  • tsconfig.json 파일을 생성하고, 필요한 컴파일러 옵션을 설정해야 합니다. (예: outDir).
  • TypeScript 관련 명령어를 package.json에 설정해 주세요. (예: 빌드 및 개발 서버 실행 명령어).
  • ts-node와 nodemon을 사용하여 개발 환경을 구성합니다.
    • nodemon과 함께 ts-node를 사용하여 . ts 파일이 변경될 때 서버를 자동으로 재시작하도록 설정합니다.
  • Mongoose나 Prisma 등 ORM을 사용하는 경우, 모델에 대한 인터페이스 또는 타입을 정의합니다.
  • 필요한 경우, declare를 사용하여 타입을 오버라이드하거나 확장합니다.

주요 변경사항

  • TS 마이그레이션

스크린샷

image

멘토에게

Copy link

@coldplay126 coldplay126 left a comment

Choose a reason for hiding this comment

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

전반적으로 훌륭하게 과제를 완수하셨습니다. TypeScript 마이그레이션이 쉽지 않았을텐데 잘 해내셨어요. 특히 MVC 패턴을 유지하면서 타입 안전성을 확보한 점과, Prisma 타입을 적극적으로 활용한 점이 인상적입니다.

export type productDto = {
name: string;
description: string;
price: string;

Choose a reason for hiding this comment

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

가격은 금액이 입력될 것 같은데 숫자가 아닌 문자인 이유가 있을까요?

};

// 상품 상세조회
const getProduct = async (userId: User["id"], productId: Product["id"]) => {

Choose a reason for hiding this comment

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

Prisma에서 생성된 타입을 적극적으로 활용하여 타입 안전성을 확보한 점이 훌륭합니다!

Comment on lines +1 to +11
export class AppError extends Error {
code?: number; // 선택적 속성으로 변경
data?: any; // 에러핸들러에서 사용하는 data 속성도 추가

constructor(message: string, code?: number, data?: any) {
super(message);
this.code = code;
this.data = data;
this.name = "AppError";
}
}

Choose a reason for hiding this comment

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

기본 Error 클래스를 확장하여 애플리케이션 전용 에러 클래스를 만든 점이 훌륭합니다. 처리의 일관성을 보장하는 좋은 패턴이에요.

@coldplay126 coldplay126 merged commit 7e361dd into codeit-sprint-fullstack:express-이태빈 Jun 24, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants