Skip to content
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

[강수정] sprint8 #24

Merged
merged 5 commits into from
Dec 25, 2024
Merged

Conversation

xcjnzvc
Copy link
Collaborator

@xcjnzvc xcjnzvc commented Dec 8, 2024

요구사항

기본

  • [x]
  • []
  • []

심화

  • [x]
  • []

주요 변경사항

스크린샷

image

멘토에게

  • 셀프 코드 리뷰를 통해 질문 이어가겠습니다.

Copy link
Collaborator

@orlein orlein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

대체로 좋습니다

app.use(express.json());
app.use(
cors({
origin: "*",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CORS의 origin: "*" 설정은 이렇게 공부할 때는 좋은데, 실무에서는 절대 이렇게 하지 마세요

Comment on lines +1 to +22
export const MockData = [
{
title: "30분 운동",
content: "ㅇㅅㅇ",
},
{
title: "130분 운동",
content: "ㅠㅡㅠ",
},
{
title: "10분 운동",
content: "ㅇㅅ2222ㅇ",
},
{
title: "1022분 운동",
content: "ㅇㅅ2222ㅇ",
},
{
title: "10112분 운동",
content: "하늘나라",
},
];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

titlecontent에 큰 제한이 없다면, 그냥 랜덤생성하시는것도 좋습니다.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 파일이 node.js에 의해 실행될 때는 mock.js 이외의 다른 파일과 무관하게, 독립적으로 실행된다는 점을 명심해주세요.

"cors": "^2.8.5",
"dotenv": "^16.4.5",
"express": "^4.21.1",
"mongoose": "^8.7.2",
"nodemon": "^3.1.7"
"prisma": "^5.22.0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

잘 동작하겠지만 prisma는 devDependencies에 설치하는것이 권장됩니다

//try {} catch(err) {console.error(err);}

//게시글 등록
router.post("/postregistration", async (req, res) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

api path는 resource 중심으로 서술하세요. 무엇을(body) 어디에(path) 어떻게(method) 이런 식입니다. router.post("/post", async (req, res) => { ... })
이렇게만 하셔도, req.body를 /post에 생성(post)한다 라는 의미가 생깁니다

@orlein orlein merged commit 3564964 into codeit-sprint-fullstack:express-강수정 Dec 25, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants