-
Notifications
You must be signed in to change notification settings - Fork 0
기존 공통 응답 제거 후 RESTful 응답 구조로 변경 + 소나 클라우드 에러 해결 #13
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
Merged
Conversation
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
2 tasks
|
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.


close #12
☑️ 완료 태스크
data필드 삭제🔎 PR 내용
issue 만들 때조차 Spring에 오염된 뇌로
ResponseEntity.ok()같은 구조를 떠올리면서,"흠.. ok()랑 no_content()랑 이것저것 추가해주면 되겠군" 거리고 있었는데요.
💩 ApiResponse 자체가 필요하지 않음
생각해보니까
ApiResponse자체가 필요가 없었다는 걸 뒤늦게 떠올렸습니다.그럼
ApiResponse가 기존에 왜 필요했냐?근데? 서버 만드는 데 더 기력을 쏟기로 마음을 바꾸면서 (과제 마감 기한도 촉박했음)
프론트는 바이브 코딩으로 전략을 바꿨고 해당 사항이 없어지게 된 거죠.
💀
ReponseEntity? Axum엔 그런 거 없음!Spring에 오염된 채, 사고를 안 하고 그냥 손가락을 움직인 셈이었는데요.
Axum에서는
IntoResponse트레잇만 구현하면 HTTP 응답이 자동으로 만들어지는 방식입니다.그래서 응답 데이터 반환 타입을
IntoResponse만 구현하면, 만사 OK인 거죠.ResponseEntity.ok()라든가,ResponseEntity.nocontent()이런 게 그냥 전혀 필요가 없다는 겁니다.그러면 반환할 때 어떻게 해야 되냐,
👉 그냥
IntoResponsetrait 구현된 데이터만 반환 '딸깍'하면 끝입니다.그래서 기존에 불필요하게 status와 커스텀 code, message를 보내고 있던 걸 모두 삭제했습니다.
얘네들은 에러에서나 필요하지 정상 응답에서는 아무 필요도 의미도 없이 자리만 차지하기 때문이죠.
1. ApiResponse 구조체 삭제 ❌
성공 응답을 { status, code, message, data }로 통일해서 wrapper로 감싸던 기존 방식 제거
성공 응답은 이제 HTTP status + 실제 데이터만 반환
2. 에러 응답 구조에서
data: {}삭제 ❌에러는 이제 HTTP status + { code, message } 구조로 단순화
에러 body에서
data: {}제거