[백지연] sprint11#57
Merged
basilry merged 1 commit intocodeit-sprint-fullstack:express-백지연from Jun 24, 2025
Hidden character warning
The head ref may contain hidden characters: "express-\ubc31\uc9c0\uc5f0-sprint11"
Merged
Conversation
basilry
reviewed
Jun 24, 2025
Contributor
basilry
left a comment
There was a problem hiding this comment.
오, 매우 잘하셨습니다.
백엔드는 실무 경력이 있으신 것 같은 정도인데요??
크게 제가 손 댈 곳이 없었습니다. 앞으로도 백엔드는 이 정도로 하시면 될 것 같네요!
| ### 자유게시글 생성 | ||
| POST http://localhost:5050/article | ||
| Authorization: Bearer {{Token}} | ||
| Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwiZW1haWwiOiJiamx5ZW9uMkBuYXZlci5jb20iLCJuYW1lIjoi7YWM7Iqk7Yq47Jyg7KCAOSIsImlhdCI6MTc1MDYxMDg2MywiZXhwIjoxNzUwNjE0NDYzfQ.cDvZ4hmyDLWGEj-7BULD5oBswX7DQZX_WdeRjSJQ7RY |
| const authorId = (req as any).auth?.id; | ||
|
|
||
| if (!authorId) { | ||
| res.status(401).json({ message: "로그인이 필요합니다." }); |
Contributor
There was a problem hiding this comment.
이런 메시지들은 enum으로 ts 파일에 하나 몰아서 관리해두는 것도 나쁘지 않습니다.
아, 확인해보니 types/errors.ts에 기초적인 형태를 구성해두셨네요.
위치를 조금 옮기시죠. types가 아니라 src/lib/constants/.. 폴더 정도가 맞을 것 같습니다.
| async function getById(id: number): Promise<any> { | ||
| const getProduct = await prisma.product.findUnique({ | ||
| where: { id: parseInt(id, 10) }, | ||
| where: { id: parseInt(id.toString(), 10) }, |
Contributor
There was a problem hiding this comment.
parseInt보다 Number가 메모리 덜 잡아먹고 빠릅니다.
그리고 기본적으로 parseInt는 두 번째 파라미터에 숫자를 안쓰면 10진수를 변환합니다.
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.
요구사항
기본 요구사항
공통
Github에 위클리 미션 PR을 만들어 주세요.
React 및 Express를 사용해 진행합니다.
TypeScript를 활용해 프로젝트의 필요한 곳에 타입을 명시해 주세요.
any 타입의 사용은 최소화해 주세요.
복잡한 객체 구조나 배열 구조를 가진 변수에 인터페이스 또는 타입 별칭을 사용하세요.
Union, Intersection, Generics 등 고급 타입을 적극적으로 사용해 주세요.
타입 별칭 또는 유틸리티 타입을 사용해 타입 복잡성을 줄여주세요.
타입스크립트 컴파일러가 에러 없이 정상적으로 작동해야 합니다.
백엔드
주요 변경사항
스크린샷
멘토에게