[윤세준] Sprint11#46
Merged
basilry merged 4 commits intocodeit-sprint-fullstack:express-윤세준from Jun 25, 2025
Hidden character warning
The head ref may contain hidden characters: "express-\uc724\uc138\uc900-sprint11"
Merged
Conversation
basilry
reviewed
Jun 25, 2025
Contributor
basilry
left a comment
There was a problem hiding this comment.
전체적으로 코드 스타일이 깔끔하고 잘 정제되어 있습니다.
프론트 소스도 그렇지만 정말 잘 하시네요.
다만 타입스크립트로 마이그레이션 하는 과정에서 unknown 타입이나 강제캐스팅 as를 사용하시는 경향이 많은데,
이런 부분들은 불확실성을 증대시키므로 지양하시는게 좋습니다.
고생하셨습니다.
| console.error('Unhandled Rejection:', reason); | ||
| }); | ||
| const app = express(); | ||
| const PORT = 5001; |
Contributor
There was a problem hiding this comment.
보통 여기있는 포트나 밑의 origin 내 url은 env로 환경변수 처리하는게 좋습니다.
| @@ -0,0 +1,58 @@ | |||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | |||
Contributor
There was a problem hiding this comment.
dist 폴더는 gitignore에 작성해서 뺴시는게 좋을 것 같습니다.
| }); | ||
|
|
||
| const app: Express = express(); | ||
| const PORT: number = 5001; |
| try { | ||
| const { userName, email, password }: { userName: string; email: string; password: string } = req.body; | ||
|
|
||
| const existingUser: User | null = await prisma.user.findUnique({ where: { email } }); |
| import jwt, { JwtPayload } from 'jsonwebtoken'; | ||
| import { User } from '@prisma/client'; | ||
|
|
||
| const SECRET_KEY = process.env.JWT_SECRET || "panda-secret"; |
Contributor
There was a problem hiding this comment.
시크릿 키를 왜 하드코딩으로 or 연산자 처리를 하였나요?
무조건 환경변수로 처리해주세요~
|
|
||
| const router: Router = express.Router(); | ||
|
|
||
| router.post("/signup", signup as unknown as RequestHandler); |
Contributor
There was a problem hiding this comment.
이거 굳이 as로 강제 타입캐스팅을 할 필요가 있었을까요?
| const router: Router = express.Router(); | ||
|
|
||
| // 댓글 조회 | ||
| router.get("/:productId/comments", getComments as unknown as RequestHandler); |
Contributor
There was a problem hiding this comment.
여기도 동일하네요. 심지어 unknown으로 강제캐스팅은 초큼...
수정바랍니다~
| const upload = multer({ storage }); | ||
|
|
||
| router.post("/upload", verifyToken, upload.single("file"), (req, res) => { | ||
| router.post("/upload", verifyToken as unknown as RequestHandler, upload.single("file"), ((req: Request, res: Response) => { |
Contributor
There was a problem hiding this comment.
여기도 있네요. 동일 문제에 대해 더 언급 안하겠습니다.
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.
공통
백엔드
아직 자유게시판 부분을 완성하지 못했습니다ㅠ