[9주차/찬찬] 워크북 제출합니다#18
Open
inhadissolve wants to merge 5 commits into
Open
Conversation
seoki180
approved these changes
Jun 2, 2026
Comment on lines
+92
to
+93
| clientID: process.env.PASSPORT_GOOGLE_CLIENT_ID!, | ||
| clientSecret: process.env.PASSPORT_GOOGLE_CLIENT_SECRET!, |
Collaborator
There was a problem hiding this comment.
환경변수는 ! 으로 단정하기 보다 외부에 추가로 변수를 선언한뒤 만약 선언이 안되었다면 error를 생성하는 식으로 구현하는게 좋습니다
const id = process.env.ID;
if(!id)
throw new Error("환경변수 ID가 선언되지 않았습니다| { | ||
| clientID: process.env.PASSPORT_GOOGLE_CLIENT_ID!, | ||
| clientSecret: process.env.PASSPORT_GOOGLE_CLIENT_SECRET!, | ||
| callbackURL: "http://localhost:3000/oauth2/callback/google", |
Collaborator
There was a problem hiding this comment.
callbackURL도 환경마다 바뀔수 있으니 baseURL을 환경변수로 빼주시면 좋습니다!
Comment on lines
+64
to
+72
| user = await prisma.user.create({ | ||
| data: { | ||
| email, | ||
| name: profile.displayName, | ||
| gender: "추후 수정", | ||
| birth: new Date(1970, 0, 1), | ||
| address: "추후 수정", | ||
| detailAddress: "추후 수정", | ||
| phoneNumber: "추후 수정", |
Collaborator
There was a problem hiding this comment.
우리가 이미 user.repository에서 prisma.user를 접근하는 로직을 만들었으니 여기서도 해당 class를 import 해서 사용하는게 좋을거 같습니다. 단순한 로직은 여러곳에서 prisma 인스턴스를 사용하는게 문제가 없을 수 있는데 추후에 DI, 의존성 문제가 발생할 수도 있으니 확인해보세요!
| * Authorization: Bearer <accessToken> | ||
| * 형식으로 토큰을 보내야 통과할 수 있습니다. | ||
| */ | ||
| const isLogin = passport.authenticate("jwt", { session: false }); |
Collaborator
There was a problem hiding this comment.
미들웨어를 선언하신건 좋지만 해당 함수도 middleware 파일로 분리하면 좋을거 같네요
또한 passport.authenticate 자체가 인증 실패시 401을 발생하지만 응답을 json으로 통일하려면 커스텀 콜백이 필요합니다
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.
✅ 실습 체크리스트
✅ 컨벤션 체크리스트