Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3주차] 기본/도전 과제 #3

Merged
merged 1 commit into from
Dec 1, 2022
Merged

[3주차] 기본/도전 과제 #3

merged 1 commit into from
Dec 1, 2022

Conversation

onpyeong
Copy link
Contributor

@onpyeong onpyeong commented Nov 3, 2022

SERVER PR


🐕 과제 구현 명세

  • [기본과제]
  • [도전과제] : movieId가 path 파라미터로 있어서 어떤 영화인지를 구분하도록 구현하기로 했는데, 영화나 드라마 모두 형태가 같다고 해서 contentId로 구현했습니다! 원래 명세를 할 때는 episode에 따라서 해당 episode를 가져올 수 있게 구현이 되어야 하는데 이 부분은 아직 구현을 못했습니다..! 추후에 해볼게요!

🐥 이런 점이 새로웠어요 / 어려웠어요

  • 3000 포트가 이미 사용중이라는 에러가 나서 해결하는데 시간이 걸렸는데, 알고보니 지난 세미나 때 켜둔 pm2를 종료를 안해서 그런거였어요.!
  • 영화를 분리하는 것까지는 구현을 했는데, 몇화인지에 따라서 해당 에피소드를 가져오는 것도 구현해봐야 될 것 같습니다!
  • 2주차 과제 피드백을 보면서 폴더 분리를 해봤는데, 어딘가 이상한거 같고, contentId가 없을 때 에러처리를 어디서 어떻게 해야하는지 잘 모르겠어요..

@onpyeong onpyeong self-assigned this Nov 3, 2022

const getContent = async (req: Request, res: Response) => {
const {contentId} = req.params;

Copy link
Member

Choose a reason for hiding this comment

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

예외처리가 필요하다면 if와 not 연산자를 활용해서 아래와 같이 에러를 핸들링해줄 수 있습니다 !

if (!contentId){
 return res.status(404).json({ status: 404, message: "데이터가 없습니다." });
}

Copy link
Member

@m1njae m1njae left a comment

Choose a reason for hiding this comment

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

영화나 드라마가 같은 형태여서 contentId로 구현해주신 점 멋지십니다👍 사실 저도 과제하면서 아차 싶었거든요🥲 과제를 하거나 개인적으로 공부하다가 궁금한 점이 있다면 언제든지 코드리뷰 조 활용해주세요:) 같이 공부해요~ 과제하느라 고생 많이 하셨습니다😊

Comment on lines +3 to +5
const getItem = async (contentId: number) => {
return contents[contentId];
};
Copy link
Member

Choose a reason for hiding this comment

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

음! 2주차 과제에 되어있던 폴더 분리는 아무래도 작성한 api에 대한 로직이 없던터라, 확실히 이번 과제에 적용하셨을 때 애매하고 긴가민가 하셨을 수도 있을거라는 생각이 듭니다.
저의 얄팍한 지식으로 프로젝트 구조에 대해서 간단히 언급해보자면 저희가 학습하고 있는 Express는 관심사 분리 원칙 어쩌구에 따라 node.js 프로젝트 구조에서 3 Layer Architecture를 도입한다고 하네요:)

세미나를 진행하면서 파트장님께서 잘 설명해주시겠지만, 간단하게라도 알고 계시면 좋을거 같아서 관련내용 링크 달아놓겠습니다!
https://charming-kyu.tistory.com/16
https://velog.io/@ju_h2/Node-express-%EC%84%9C%EB%B2%84%EC%97%90-3-Layer-Architecture-%EC%A0%81%EC%9A%A9%ED%95%98%EA%B8%B0

Choose a reason for hiding this comment

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

제 블로그가 언급되어 지나가는길에 구경하고 가요.
화이팅입니다! 😚🎉🥕🙏

Copy link
Member

Choose a reason for hiding this comment

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

헉😮..! 유익한 내용 공유해주셔서 감사합니다 !🙏

"description": "성대한 결혼식에서 신부의 웨딩드레스가 벗겨지는 사고가 발생한다. 한바다는 호텔을 상대로 10억 청구 소송을 진행하게 되고, 영우는 준호와 일일 커플이 되어 호텔 잠입 조사를 벌인다."
}, {
"episode": 3,
"description": "친형을 폭행하여 죽음에 이르게 한 중증 자폐인이 기소된다. 영우는 자폐를 지닌 피고인과 소통하기 위해 기발한 방법을 생각해 내고, 한바다 변호사들을 불러 모은다."
Copy link
Member

Choose a reason for hiding this comment

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

크.. 우영우 에피소드 설명까지! 정성이네요😊

Copy link

@kkyu0718 kkyu0718 left a comment

Choose a reason for hiding this comment

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

늦은 코드리뷰 왔습니당 늦어져서 미안해용 😂
코드 모두 보았는데 깔끔하게 잘하신거 같아요!! 저도 열심히 배우고 갑니다!

const getContent = async (req: Request, res: Response) => {
const {contentId} = req.params;

const data = await getItem(Number(contentId));
Copy link

Choose a reason for hiding this comment

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

안녕하세요 늦은 코드 리뷰 하러 왔어요 🥲 늦어져서 미안합니당
최근 세미나에서 저도 얻은 꿀팁이지만 +contentId 로 하면 string이 바로 number로 바뀐다고 하네용

"episode": 6,
"description": "요환의 갑작스러운 돌발 행동으로 인구의 신변을 보호하기 위한 계획에 차질이 생긴다. 요환의 마약제국을 무너뜨리기 위한 작전이 시작되고, 그 사이 이상준이 공항에 도착한다."
}],
"episodeCount": 6
Copy link

Choose a reason for hiding this comment

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

살짝 기억이 가물가물해서 여쭤보는건데 혹시 저희 episode의 개수를 episode.length가 아니라 episodeCount: 6 으로 했던 이유가 뭐였죵..??! 개인적으로 보았을 때는 episodes 개수에 대한 정보는 충분히 들어가는거 같은데 따로 column를 만드는게 맞는지? 에 대한 의문이 저는 쪼~끔 들어용!

@@ -0,0 +1,56 @@
import { Content } from "../interface/content";
Copy link

Choose a reason for hiding this comment

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

interface 를 이용해서 type 정의를 하니 코드가 깔끔해보여서 좋아용

@onpyeong onpyeong merged commit 689ef0e into main Dec 1, 2022
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