-
Notifications
You must be signed in to change notification settings - Fork 27
[윤해인_BackEnd] 10주차 과제 제출합니다. #36
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
base: main
Are you sure you want to change the base?
Conversation
asa9874
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
200 OK + empty Body 를 반환하는게 맞는지,
404 NOT FOUND를 반환하는게 맞는지는
조금 더 생각해볼 부분인 것 같습니다.
해당 부분에 대해 저의 개인적인 의견을 공유드립니다
단건 조회이지만 리소스가 존재하지 않을때 -> 404 NotFound
리스트 조회지만 리소스가 존재하지 않을때 -> 200 + [] (빈 컬렉션을 찾았다는 의미의 200)
삭제와 같이 별도로 반환할 컨텐츠가 존재하지않을때 -> 204 No content
해당 부분에 대해서는 저도 예전에 조사했을때 의견이 많이 갈리는것같아서 정확하게 뭐가 맞다라고는 말씀드리기 어려울거같네요
| } | ||
| // Create (POST) | ||
| @PostMapping | ||
| public ResponseEntity<Article> create(@RequestBody Article article) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
현재 방식에서는 Article 을 Body로 받고있는데, DTO에 대해 알아보시면 좋을거같아요.
DTO를 활용하면 지금처럼 Create할때 불필요한 id를 입력받지않을수있어요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 사항 반영해 추가 리팩토링 진행하겠습니다. 감사합니다.
| private Map<Integer, Article> articles = new HashMap<>(); | ||
| private int nextId = 1; | ||
|
|
||
| static class Article { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Article 내부의 변수는 private로 선언하고 getter, setter을 활용해보시면 좋을거같아요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
안녕하세요.
피드백 반영하여 리팩토링 진행했습니다. 감사합니다.
|
6주차 과제 완료했습니다. 새롭고 낯선 개념들이 한꺼번에 접해서 꽤나 혼잡해서 각 파일이 무슨 역할을 맡아야하는지, 그로 인해 어떤 함수를 갖고있어야 하는지를 파악해나가는데 시간이 좀 걸렸습니다. 진행하며 생긴궁금한 점은
그 밖에도 수정할 부분/생각해볼 부분이 있다면 말씀해주세요. 감사합니다. |
|
백엔드 비기너 10주차 과제 PR 입니다. 처음에는 영속성 컨텍스트와 부모-자식, 연관관계가 많이 헷갈렸는데 직접 실습해보면서 |
백엔드 비기너 5주차 과제 PR 드립니다.
어노테이션에 대해서는 공식 문서를 최대한 활용해서 공부했고,
CRUD API 중 GET이 가장 인상적이었습니다.
200 OK + empty Body 를 반환하는게 맞는지,
404 NOT FOUND를 반환하는게 맞는지는
조금 더 생각해볼 부분인 것 같습니다.