[안예진]sprint5 미션 제출#5
Open
yyejin00 wants to merge 5 commits intocodeit-sprint-fullstack:express-안예진from
Hidden character warning
The head ref may contain hidden characters: "express-\uc548\uc608\uc9c4-sprint5"
Open
Conversation
wseungjin
approved these changes
Jan 20, 2026
| const { search } = req.query; | ||
| const query = {}; | ||
| if (search) { | ||
| query.$or = [ |
Collaborator
There was a problem hiding this comment.
const query = {
{ name: { $regex: search, $option: "i" } },
{ description: { $regex: search, $option: "i" } },
};
|
|
||
| productRouter.delete("/:id", async (req, res, next) => { | ||
| try { | ||
| const deleteProduct = await Product.findByIdAndDelete(req.params.id); |
Collaborator
There was a problem hiding this comment.
findByIdAndDelete
delete : true 이런식으로 합니다
| //상품 수정 | ||
| productRouter.patch("/:id", async (req, res, next) => { | ||
| try { | ||
| const { name, description, price, tags } = req.body; |
| } | ||
| }); | ||
|
|
||
| //상품등록, 중복확인? |
| productRouter.get("/", async (req, res, next) => { | ||
| //상품 목록 조회 | ||
| try { | ||
| const products = await Product.find().select("_id name price createdAt"); //SELECT id, name, price, created_at FROM products; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
백엔드 구현 요구사항
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를 활용해 주세요.