/api/my_place
method: GET
request: user_num (int)
response: place_list (json)
/api/my_place
method: POST
request: content (string) - 내용
title (string) - 장소이름
img (string) - 이미지 링크
category_num (int) - 등록할 카테고리 아이디
user_num (int) - 등록한 유저 아이디
response: ok
/api/my_place
method: DELETE
request: num (int) - 장소 아이디
response: ok
/api/place
method: GET
request: category_num (int) - 필터링을 위한 카테고리 아이디 (0이면 전체)
response: place_list (json)
- 선택한 카테고리를 기준으로 룰렛을 돌려서 맛집을 추천해주는 화면
주요 기능
setInterval을 사용하여 스케쥴링을 통한 룰렛 돌리기
ajax로 api 호출 /api/place(GET), /api/category(GET)- 내 장소 등록하는 화면
ajax로 api 호출 /api/my_place(POST), /api/category(GET)
mongodb에서 계층구조로 Collection을 호출할 필요
$lookup 사용
'$lookup': {
'from': "user",
'localField': "user.num",
'foreignField': "place.user_num",
'as': "user",
},
하위 객체를 [item] -> {item} 변환 필요
$unwind 사용
'$unwind': {'path':'$user'}
불필요한 컬럼 제거
$unset 사용
'$unset': ["_id", 'user_num', 'user._id', 'user.password']
어떠한 주제도 주어주지 않고 미니 프로젝트를 진행하는것에는 부담스러웠지만 작은 기획이라도 생각해보고 스스로 진행해 보면서 재미있게 작업이 가능했습니다.