Suyeon Jung

Complete culture category

......@@ -336,7 +336,28 @@ router.get('/safe', function(req, res) {
});
router.get('/culture', function(req, res) {
res.send('This is culture');
// 노래방
let sing_url = 'https://openapi.gg.go.kr/Songclub';
let qs = `?Type=json&KEY=${GYEONGI_API_KEY}&SIGUN_CD=${SIGUN_CODE}`;
request({
url: sing_url + qs,
method: 'GET'
}, function(err, response, body) {
if (!err && res.statusCode == 200) {
let sing_result = JSON.parse(body);
console.log(sing_result);
let sings = [];
for (let i = 0; i < sing_result.Songclub[1].row.length; i++) {
sing = sing_result.Songclub[1].row[i];
// 폐업인 지점 제외
if (!sing['BSN_STATE_NM'].includes('폐업')) {
console.log('sing', sing);
sings.push(sing);
}
}
res.render('culture_result', { sings: sings });
}
});
});
router.get('/shop', function(req, res) {
......
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>✍️ 결과 페이지</title>
</head>
<body>
<h1>🎤 노래방 현황</h1>
<%for (var i =0; i <sings.length; i++){%>
<li>
<%=sings[i].BIZPLC_NM%>
</li>
<%}%>
<h3>총 노래방 개수 :
<%=sings.length%>
</h3>
</body>
</html>
\ No newline at end of file