반응형
드디어 2일차에 접어들었다 ...
오늘은 팀원들과 많은 얘기도 나누고 Git에 연결도해서 첫 날과 다르게 어느정도 정리가 된거 같습니다.
2일차에는 최원장 리액트 튜터님과 면담을하고 좋은 시간을 가졌습니다. (튜터님 최고...)
슬랙에서 물어보셔도 진짜 빠르게 답변해주시고 같이 고민해주셔서 너무 좋았습니다.
그렇게 오늘은 페이지 만들기에 들어갔습니다.
오늘의 기능구현은 comment 기능구현을 했습니다.
comment_post 기능
@app.route("/comment", methods=["POST"])
def comment_post():
uuid_receive = request.form['uuid_give']
name_receive = request.form['name_give']
comment_receive = request.form['comment_give']
doc = {
"uuid": uuid_receive,
"name": name_receive,
"comment": comment_receive,
}
db.comment.insert_one(doc)
return jsonify({'msg': '작성 완료!'})
function save_comment() {
const uuid = Math.floor(Math.random() * 10000000)
const name = $("#name").val()
const comment = $("#comment").val()
$.ajax({
type: "POST",
url: "/comment",
data: { uuid_give: uuid, name_give: name, comment_give: comment },
success: function (response) {
alert(response["msg"])
window.location.reload()
},
})
}
commnet 삭제기능
@app.route("/comment", methods=["DELETE"])
def comment_delete():
uuid_receive = request.form["uuid_give"]
db.comment.delete_one({"uuid": uuid_receive})
return jsonify({"msg": "삭제 완료!"})
function delete_comment(uuid) {
$.ajax({
type: "DELETE",
url: "/comment",
data: { uuid_give: uuid },
success: function (response) {
alert(response["msg"])
window.location.reload()
},
})
}
UI 꾸미고 기능 구현하고 팀원과 모르는거 질의응답하는 시간을 가졌습니다.
기능과 페이지 만들면서 하루일과가 끝나버렸습니다.
반응형
'내일배움캠프' 카테고리의 다른 글
WIL 1주차 정리 (0) | 2022.11.06 |
---|---|
TIL 5일차 정리 (0) | 2022.11.04 |
TIL 4일차 정리 (0) | 2022.11.03 |
TIL 3일차 정리 (0) | 2022.11.02 |
TIL 1일차 정리 (0) | 2022.10.31 |