Suyeon Jung

Complete food category

......@@ -183,6 +183,7 @@ router.get('/food', function(req, res) {
let GYEONGI_API_KEY = process.env.GYEONGGI_APIKEY;
let sigun_cd = SIGUN_CODE;
let url = 'https://openapi.gg.go.kr/PlaceThatDoATasteyFoodSt';
let fastfood_url = 'https://openapi.gg.go.kr/Genrestrtfastfood'
let qs = `?KEY=${GYEONGI_API_KEY}&SIGUN_CD=${sigun_cd}&Type=json`;
request({
......@@ -201,7 +202,25 @@ router.get('/food', function(req, res) {
}
console.log('food_result', food_result);
console.log('store_names', store_names);
res.render('result', { store_names: store_names });
request({
url: fastfood_url + qs,
method: 'GET'
}, function(err, response, body) {
if (!err && res.statusCode == 200) {
let fast_food_result = JSON.parse(body);
let fast_store_names = []
for (let i = 0; i < fast_food_result.Genrestrtfastfood[1].row.length; i++) {
fast_store_name = fast_food_result.Genrestrtfastfood[1].row[i];
if (fast_store_name['BSN_STATE_NM'] != '폐업') {
console.log('fast_store_name', fast_store_name);
fast_store_names.push(fast_store_name);
}
}
res.render('result', { store_names: store_names, fast_store_names: fast_store_names });
}
})
}
});
});
......
......@@ -18,6 +18,15 @@
<%=store_names.length%>
</h3>
<h1>🍔 패스트푸드점 현황 </h1>
<%for (var i =0; i <fast_store_names.length; i++){%>
<li>
<%=fast_store_names[i].BIZPLC_NM%>
</li>
<%}%>
<h3>총 맛집 개수 :
<%=fast_store_names.length%>
</h3>
</body>
......