Skip to content

[홍승전] Sprint 6#116

Merged
iamjaeholee merged 1 commit intocodeit-sprint-fullstack:react-홍승전from
damiano1130:react-홍승전
Aug 27, 2025

Hidden character warning

The head ref may contain hidden characters: "react-\ud64d\uc2b9\uc804"
Merged

[홍승전] Sprint 6#116
iamjaeholee merged 1 commit intocodeit-sprint-fullstack:react-홍승전from
damiano1130:react-홍승전

Conversation

@damiano1130
Copy link

요구사항

기본

공통

  • Github에 스프린트 미션 PR을 만들어 주세요.

  • React, Express를 사용해 진행합니다.
    프론트엔드 구현 요구사항
    랜딩 페이지

  • HTML과 CSS로 구현한 랜딩페이지를 React로 마이그레이션하세요.

  • 랜딩 페이지 url path는 "/"로 설정하세요.
    중고마켓 페이지

  • 중고마켓 페이지 url path를 "/items"으로 설정하세요.

  • 페이지 주소가 "/items" 일 때 상단내비게이션바의 "중고마켓" 버튼의 색상은 "3692FF"입니다.

  • 중고마켓 페이지 판매 중인 상품은 본인이 만든 GET 메서드를 사용해 주세요.

  • 다만 좋아요 순 정렬 기능은 제외해 주세요.

  • 사진은 디폴트 이미지로 프론트엔드에서 처리해주세요.

  • 베스트 상품 목록 조회는 구현하지 않습니다.

  • '상품 등록하기' 버튼을 누르면 "/registration" 로 이동합니다. ( 빈 페이지 )
    상품 등록 페이지

  • PC, Tablet, Mobile 디자인에 해당하는 상품 등록 페이지를 만들어 주세요.

  • 상품 등록 url path는 "/registration"입니다.

  • 상품 등록은 본인이 만든 POST 메서드를 사용해 주세요.

  • 등록 성공 시, 해당 상품 상세 페이지로 이동합니다. (빈페이지)

백엔드 구현 요구사항
중고마켓

  • Product 스키마를 작성해 주세요.

  • id, name, description, price, tags, createdAt, updatedAt필드를 가집니다.

  • 필요한 필드가 있다면 자유롭게 추가해 주세요.

  • 상품 등록 API를 만들어 주세요.

  • name, description, price, tags를 입력하여 상품을 등록합니다.

  • 상품 상세 조회 API를 만들어 주세요.

  • id, name, description, price, tags, createdAt를 조회합니다.

  • 상품 수정 API를 만들어 주세요.

  • PATCH 메서드를 사용해 주세요.

  • 상품 삭제 API를 만들어 주세요.

  • 상품 목록 조회 API를 만들어 주세요.

  • id, name, price, createdAt를 조회합니다.

  • offset 방식의 페이지네이션 기능을 포함해 주세요.

  • 최신순(recent)으로 정렬할 수 있습니다.

  • name, description에 포함된 단어로 검색할 수 있습니다.

  • 각 API에 적절한 에러 처리를 해 주세요.

  • 각 API 응답에 적절한 상태 코드를 리턴하도록 해 주세요.

  • . env 파일에 환경 변수를 설정해 주세요.

  • CORS를 설정해 주세요.

  • render.com로 배포해 주세요.

  • MongoDB를 활용해 주세요.

##심화 요구사항
###프론트엔드 구현 요구사항
###상품 등록 페이지

  • 모든 입력 input box에 빈 값이 있을 경우, 등록 버튼이 비활성화됩니다.
  • 태그를 입력한 후 엔터키를 누르면, 그 태그가 칩 형태로 쌓입니다.
  • 상품명, 상품 소개, 판매 가격, 태그에 대한 유효성 검사 Custom Hook을 만들어주세요. 유효성 검사를 통과하지 않을 경우, 각 input에 빨간색 테두리와, 각각의 Input 아래에 빨간색 에러 메시지를 보여주세요.
    유효한 조건
    상품명: 1자 이상, 10자 이내
    상품 소개: 10자 이상, 100자 이내
    판매 가격: 1자 이상, 숫자
    태그: 5글자 이내

스크린샷

image

멘토에게

  • 셀프 코드 리뷰를 통해 질문 이어가겠습니다.

@iamjaeholee iamjaeholee changed the base branch from main to react-홍승전 August 27, 2025 00:59
Copy link

@iamjaeholee iamjaeholee left a comment

Choose a reason for hiding this comment

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

스프린트 미션 6 수행하느라 수고하셨습니다 🥇

프론트엔드에 대한 미션도 있었는데요.
그것과 관련한 코드는 PR에서 딱히 보이지가 않네요.
혹시 수행하셨는데 제가 못 찾는 것일까봐 피드백 남겨놓도록 하겠습니다.

백엔드 코드는 글로벌 에러핸들링을 활용해 API가 안정적으로 동작할 수 있도록 잘 만들어주신 것 같아요 👍

Comment on lines +1 to +5
server/node_modules/
client/node_modules/
.env
server/.env
client/.env

Choose a reason for hiding this comment

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

gitignore에 .env와 node_modules 관련하여 설정을 잘 해주셨어요.

.env
node_modules

이렇게 작성을 해도 동일한 기능을 해서 참고용으로 적어드립니다.

Comment on lines +14 to +21
ProductSchema.set("toJSON", {
virtuals: true,
versionKey: false,
transform: (_, ret) => {
ret.id = ret._id.toString();
delete ret._id;
},
});

Choose a reason for hiding this comment

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

JSON 문법으로 컨벤션 맞추는 구문을 추가하셨군요 👍

Comment on lines +27 to +35
const { _id, name, description, price, tags, createdAt } = p;
return res.json({
id: _id.toString(),
name,
description,
price,
tags,
createdAt,
});

Choose a reason for hiding this comment

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

const {_id, ...rest } = p;
resturn res.json({
  id: ...,
  ...rest
})

이렇게 destructuring을 활용하는 방법도 있으니 참고해보세요 : -)

Comment on lines +88 to +94
const [items, total] = await Promise.all([
Product.find(filter)
.sort(sort === "recent" ? { createdAt: -1 } : {})
.skip(offset)
.limit(limit)
.select("name price createdAt")
.lean(),

Choose a reason for hiding this comment

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

조회 API에서 lean 메서드를 사용하신 이유는 퍼포먼스 개선을 위한 것이라고 생각하면 될까요 ? 🤔


const app = express();

app.use(cors({ origin: process.env.CORS_ORIGIN?.split(",") || "*" }));

Choose a reason for hiding this comment

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

origin 설정을 환경변수로 받아서 해주는 것 매우 좋은 방법입니다.
더 보안적으로 서버를 설계하게 되면 cors({origin: ""})는 지양하는 문법이기에 참고 부탁드립니다 ^^
혹은 개발, 로컬 환경에서만 "
"사용하게끔 설정하는 것도 방법 중에 하나에요 !

app.use(express.json());
app.use(morgan("dev"));

app.get("/health", (_, res) => res.status(200).json({ ok: true }));

Choose a reason for hiding this comment

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

health체크 엔드포인트를 만들어 둔 것 너무 좋습니다 👍

Comment on lines +21 to +25
app.use((err, req, res, next) => {
console.error(err);
const status = err.status || 500;
res.status(status).json({ message: err.message || "Internal Server Error" });
});

Choose a reason for hiding this comment

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

글로벌 에러 핸들러를 너무 잘 활용해주셨네요 ㅎㅎ

@iamjaeholee iamjaeholee merged commit aa5c944 into codeit-sprint-fullstack:react-홍승전 Aug 27, 2025
1 check passed
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.

2 participants