-
Notifications
You must be signed in to change notification settings - Fork 15
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
[강수정] sprint8 #24
Conversation
There was a problem hiding this 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: "*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CORS의 origin: "*"
설정은 이렇게 공부할 때는 좋은데, 실무에서는 절대 이렇게 하지 마세요
export const MockData = [ | ||
{ | ||
title: "30분 운동", | ||
content: "ㅇㅅㅇ", | ||
}, | ||
{ | ||
title: "130분 운동", | ||
content: "ㅠㅡㅠ", | ||
}, | ||
{ | ||
title: "10분 운동", | ||
content: "ㅇㅅ2222ㅇ", | ||
}, | ||
{ | ||
title: "1022분 운동", | ||
content: "ㅇㅅ2222ㅇ", | ||
}, | ||
{ | ||
title: "10112분 운동", | ||
content: "하늘나라", | ||
}, | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
title
과 content
에 큰 제한이 없다면, 그냥 랜덤생성하시는것도 좋습니다.
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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) => { |
There was a problem hiding this comment.
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
)한다 라는 의미가 생깁니다
요구사항
기본
심화
주요 변경사항
스크린샷
멘토에게