Suyeon Jung

Change api from songclub to movietheater : culture result

...@@ -404,26 +404,26 @@ router.get('/safe', function(req, res) { ...@@ -404,26 +404,26 @@ router.get('/safe', function(req, res) {
404 }); 404 });
405 405
406 router.get('/culture', function(req, res) { 406 router.get('/culture', function(req, res) {
407 - // 노래방 407 + // 영화관
408 - let sing_url = 'https://openapi.gg.go.kr/Songclub'; 408 + let movie_url = 'https://openapi.gg.go.kr/MovieTheater';
409 let qs = `?Type=json&KEY=${GYEONGI_API_KEY}&SIGUN_CD=${SIGUN_CODE}`; 409 let qs = `?Type=json&KEY=${GYEONGI_API_KEY}&SIGUN_CD=${SIGUN_CODE}`;
410 request({ 410 request({
411 - url: sing_url + qs, 411 + url: movie_url + qs,
412 method: 'GET' 412 method: 'GET'
413 }, function(err, response, body) { 413 }, function(err, response, body) {
414 if (!err && res.statusCode == 200) { 414 if (!err && res.statusCode == 200) {
415 - let sing_result = JSON.parse(body); 415 + let movie_result = JSON.parse(body);
416 - console.log(sing_result); 416 + console.log(movie_result);
417 - let sings = []; 417 + let movies = [];
418 - for (let i = 0; i < sing_result.Songclub[1].row.length; i++) { 418 + for (let i = 0; i < movie_result.MovieTheater[1].row.length; i++) {
419 - sing = sing_result.Songclub[1].row[i]; 419 + movie = movie_result.MovieTheater[1].row[i];
420 // 폐업인 지점 제외 420 // 폐업인 지점 제외
421 - if (!sing['BSN_STATE_NM'].includes('폐업') && userArea(sing, 'REFINE_LOTNO_ADDR', user_dong)) { 421 + if (!movie['BSN_STATE_NM'].includes('폐업') && userArea(movie, 'REFINE_LOTNO_ADDR', user_dong)) {
422 - console.log('sing', sing); 422 + console.log('movie', movie);
423 - sings.push(sing); 423 + movies.push(movie);
424 } 424 }
425 } 425 }
426 - res.render('result', { category: 'culture', sings: sings, userLocation: userLocation }); 426 + res.render('result', { category: 'culture', movies: movies, userLocation: userLocation });
427 } 427 }
428 }); 428 });
429 }); 429 });
......
1 -<h1>🎤 노래방 현황</h1> 1 +<h1>🎬 영화관 현황</h1>
2 <table class="table"> 2 <table class="table">
3 <thead> 3 <thead>
4 <th>사업장명</th> 4 <th>사업장명</th>
5 <th>도로명주소</th> 5 <th>도로명주소</th>
6 </thead> 6 </thead>
7 <tbody> 7 <tbody>
8 - <%for (var i =0; i <sings.length; i++){%> 8 + <%for (var i =0; i <movies.length; i++){%>
9 <tr> 9 <tr>
10 <td> 10 <td>
11 - <%=sings[i].BIZPLC_NM%> 11 + <%=movies[i].BIZPLC_NM%>
12 </td> 12 </td>
13 <td> 13 <td>
14 - <%=sings[i].REFINE_ROADNM_ADDR%> 14 + <%=movies[i].REFINE_ROADNM_ADDR%>
15 </td> 15 </td>
16 </tr> 16 </tr>
17 <%}%> 17 <%}%>
...@@ -19,6 +19,6 @@ ...@@ -19,6 +19,6 @@
19 </table> 19 </table>
20 20
21 21
22 -<h3>총 노래방 개수 : 22 +<h3>총 영화관 개수 :
23 - <%=sings.length%> 23 + <%=movies.length%>
24 </h3> 24 </h3>
...\ No newline at end of file ...\ No newline at end of file
......