Suyeon Jung

Fix error

...@@ -16,135 +16,135 @@ let user_longitude; ...@@ -16,135 +16,135 @@ let user_longitude;
16 // 결과 중 사용자 근처인지 검사하기 위한 변수 16 // 결과 중 사용자 근처인지 검사하기 위한 변수
17 let user_target; 17 let user_target;
18 let sigun = [{ 18 let sigun = [{
19 - sigun_name: '가평군', 19 + sigun_name: '가평군',
20 - sigun_code: 41820 20 + sigun_code: 41820
21 - }, 21 + },
22 - { 22 + {
23 - sigun_name: '경기도', 23 + sigun_name: '경기도',
24 - sigun_code: 41000 24 + sigun_code: 41000
25 - }, 25 + },
26 - { 26 + {
27 - sigun_name: '고양시', 27 + sigun_name: '고양시',
28 - sigun_code: 41280 28 + sigun_code: 41280
29 - }, 29 + },
30 - { 30 + {
31 - sigun_name: '과천시', 31 + sigun_name: '과천시',
32 - sigun_code: 41290 32 + sigun_code: 41290
33 - }, 33 + },
34 - { 34 + {
35 - sigun_name: '광명시', 35 + sigun_name: '광명시',
36 - sigun_code: 41210 36 + sigun_code: 41210
37 - }, 37 + },
38 - { 38 + {
39 - sigun_name: '광주시', 39 + sigun_name: '광주시',
40 - sigun_code: 41610 40 + sigun_code: 41610
41 - }, 41 + },
42 - { 42 + {
43 - sigun_name: '구리시', 43 + sigun_name: '구리시',
44 - sigun_code: 41310 44 + sigun_code: 41310
45 - }, 45 + },
46 - { 46 + {
47 - sigun_name: '군포시', 47 + sigun_name: '군포시',
48 - sigun_code: 41410 48 + sigun_code: 41410
49 - }, 49 + },
50 - { 50 + {
51 - sigun_name: '김포시', 51 + sigun_name: '김포시',
52 - sigun_code: 41570 52 + sigun_code: 41570
53 - }, 53 + },
54 - { 54 + {
55 - sigun_name: '남양주시', 55 + sigun_name: '남양주시',
56 - sigun_code: 41360 56 + sigun_code: 41360
57 - }, 57 + },
58 - { 58 + {
59 - sigun_name: '동두천시', 59 + sigun_name: '동두천시',
60 - sigun_code: 41250 60 + sigun_code: 41250
61 - }, 61 + },
62 - { 62 + {
63 - sigun_name: '부천시', 63 + sigun_name: '부천시',
64 - sigun_code: 41190 64 + sigun_code: 41190
65 - }, 65 + },
66 - { 66 + {
67 - sigun_name: '성남시', 67 + sigun_name: '성남시',
68 - sigun_code: 41130 68 + sigun_code: 41130
69 - }, 69 + },
70 - { 70 + {
71 - sigun_name: '수원시', 71 + sigun_name: '수원시',
72 - sigun_code: 41110 72 + sigun_code: 41110
73 - }, 73 + },
74 - { 74 + {
75 - sigun_name: '시흥시', 75 + sigun_name: '시흥시',
76 - sigun_code: 41390 76 + sigun_code: 41390
77 - }, 77 + },
78 - { 78 + {
79 - sigun_name: '안산시', 79 + sigun_name: '안산시',
80 - sigun_code: 41270 80 + sigun_code: 41270
81 - }, 81 + },
82 - { 82 + {
83 - sigun_name: '안성시', 83 + sigun_name: '안성시',
84 - sigun_code: 41550 84 + sigun_code: 41550
85 - }, 85 + },
86 - { 86 + {
87 - sigun_name: '안양시', 87 + sigun_name: '안양시',
88 - sigun_code: 41170 88 + sigun_code: 41170
89 - }, 89 + },
90 - { 90 + {
91 - sigun_name: '양주시', 91 + sigun_name: '양주시',
92 - sigun_code: 41630 92 + sigun_code: 41630
93 - }, 93 + },
94 - { 94 + {
95 - sigun_name: '양평군', 95 + sigun_name: '양평군',
96 - sigun_code: 41830 96 + sigun_code: 41830
97 - }, 97 + },
98 - { 98 + {
99 - sigun_name: '여주시', 99 + sigun_name: '여주시',
100 - sigun_code: 41670 100 + sigun_code: 41670
101 - }, 101 + },
102 - { 102 + {
103 - sigun_name: '연천군', 103 + sigun_name: '연천군',
104 - sigun_code: 41800 104 + sigun_code: 41800
105 - }, 105 + },
106 - { 106 + {
107 - sigun_name: '오산시', 107 + sigun_name: '오산시',
108 - sigun_code: 41370 108 + sigun_code: 41370
109 - }, 109 + },
110 - { 110 + {
111 - sigun_name: '용인시', 111 + sigun_name: '용인시',
112 - sigun_code: 41460 112 + sigun_code: 41460
113 - }, 113 + },
114 - { 114 + {
115 - sigun_name: '의왕시', 115 + sigun_name: '의왕시',
116 - sigun_code: 41430 116 + sigun_code: 41430
117 - }, 117 + },
118 - { 118 + {
119 - sigun_name: '의정부시', 119 + sigun_name: '의정부시',
120 - sigun_code: 41150 120 + sigun_code: 41150
121 - }, 121 + },
122 - { 122 + {
123 - sigun_name: '이천시', 123 + sigun_name: '이천시',
124 - sigun_code: 41500 124 + sigun_code: 41500
125 - }, 125 + },
126 - { 126 + {
127 - sigun_name: '파주시', 127 + sigun_name: '파주시',
128 - sigun_code: 41480 128 + sigun_code: 41480
129 - }, 129 + },
130 - { 130 + {
131 - sigun_name: '평택시', 131 + sigun_name: '평택시',
132 - sigun_code: 41220 132 + sigun_code: 41220
133 - }, 133 + },
134 - { 134 + {
135 - sigun_name: '포천시', 135 + sigun_name: '포천시',
136 - sigun_code: 41650 136 + sigun_code: 41650
137 - }, 137 + },
138 - { 138 + {
139 - sigun_name: '하남시', 139 + sigun_name: '하남시',
140 - sigun_code: 41450 140 + sigun_code: 41450
141 - }, 141 + },
142 - { 142 + {
143 - sigun_name: '화성시', 143 + sigun_name: '화성시',
144 - sigun_code: 41590 144 + sigun_code: 41590
145 - }, 145 + },
146 -] 146 + ]
147 - 147 + // 결과 중 사용자 근처인지 검사하기 위한 함수
148 let userArea = function(target, targetKey, user) { 148 let userArea = function(target, targetKey, user) {
149 if (target[targetKey].includes(user)) { 149 if (target[targetKey].includes(user)) {
150 return true; 150 return true;
...@@ -160,9 +160,15 @@ router.post('/', function(req, res) { ...@@ -160,9 +160,15 @@ router.post('/', function(req, res) {
160 user_gu = req.body.gu; 160 user_gu = req.body.gu;
161 user_dong = req.body.dong; 161 user_dong = req.body.dong;
162 userLocation = `${user_sigun} ${user_gu} ${user_dong}`; 162 userLocation = `${user_sigun} ${user_gu} ${user_dong}`;
163 - console.log(user_sigun); 163 + if (user_gu == '') {
164 - console.log(user_gu); 164 + user_target = user_dong;
165 - console.log(user_dong); 165 + } else {
166 + user_target = user_gu;
167 + }
168 + console.log('user_sigun', user_sigun);
169 + console.log('user_gu', user_gu);
170 + console.log('user_dong', user_dong);
171 +
166 let KAKAO_API_KEY = process.env.KAKAO_APIKEY; 172 let KAKAO_API_KEY = process.env.KAKAO_APIKEY;
167 let kakaoOptions = { 173 let kakaoOptions = {
168 url: 'https://dapi.kakao.com/v2/local/search/address.json', 174 url: 'https://dapi.kakao.com/v2/local/search/address.json',
...@@ -189,8 +195,8 @@ router.post('/', function(req, res) { ...@@ -189,8 +195,8 @@ router.post('/', function(req, res) {
189 var result = JSON.parse(body); 195 var result = JSON.parse(body);
190 console.log('result', result); 196 console.log('result', result);
191 user_latitude = result.documents[0].address.x; 197 user_latitude = result.documents[0].address.x;
192 - user_logitude = result.documents[0].address.y; 198 + user_longitude = result.documents[0].address.y;
193 - console.log('위도, 경도', user_latitude, user_logitude); 199 + console.log('위도, 경도', user_latitude, user_longitude);
194 } 200 }
195 }) 201 })
196 res.render('category', { userLocation: userLocation }); 202 res.render('category', { userLocation: userLocation });
...@@ -215,7 +221,7 @@ router.get('/food', function(req, res) { ...@@ -215,7 +221,7 @@ router.get('/food', function(req, res) {
215 for (let i = 0; i < food_result.PlaceThatDoATasteyFoodSt[1].row.length; i++) { 221 for (let i = 0; i < food_result.PlaceThatDoATasteyFoodSt[1].row.length; i++) {
216 // 상호명, 음식명, 전화번호, 도로명주소(REFINE_ROADNM_ADDR), 지번 주소(REFINE_LOTNO_ADDR) 222 // 상호명, 음식명, 전화번호, 도로명주소(REFINE_ROADNM_ADDR), 지번 주소(REFINE_LOTNO_ADDR)
217 store = food_result.PlaceThatDoATasteyFoodSt[1].row[i]; 223 store = food_result.PlaceThatDoATasteyFoodSt[1].row[i];
218 - if (userArea(store, 'REFINE_LOTNO_ADDR', user_dong)) { 224 + if (userArea(store, 'REFINE_LOTNO_ADDR', user_target)) {
219 console.log('store', store); 225 console.log('store', store);
220 stores.push(store); 226 stores.push(store);
221 } 227 }
...@@ -232,12 +238,12 @@ router.get('/food', function(req, res) { ...@@ -232,12 +238,12 @@ router.get('/food', function(req, res) {
232 for (let i = 0; i < fast_food_result.Genrestrtfastfood[1].row.length; i++) { 238 for (let i = 0; i < fast_food_result.Genrestrtfastfood[1].row.length; i++) {
233 fast_food_store = fast_food_result.Genrestrtfastfood[1].row[i]; 239 fast_food_store = fast_food_result.Genrestrtfastfood[1].row[i];
234 // 폐업인 지점 제외 240 // 폐업인 지점 제외
235 - if (fast_food_store['BSN_STATE_NM'] != '폐업' && userArea(fast_food_store, 'REFINE_LOTNO_ADDR', user_dong)) { 241 + if (fast_food_store['BSN_STATE_NM'] != '폐업' && userArea(fast_food_store, 'REFINE_LOTNO_ADDR', user_target)) {
236 console.log('fast_store_name', fast_food_store); 242 console.log('fast_store_name', fast_food_store);
237 fast_food_stores.push(fast_food_store); 243 fast_food_stores.push(fast_food_store);
238 } 244 }
239 } 245 }
240 - res.render('food_result', { stores: stores, fast_food_stores: fast_food_stores }); 246 + res.render('result', { category: 'food', stores: stores, fast_food_stores: fast_food_stores, userLocation: userLocation, grade: 'A' });
241 } 247 }
242 248
243 }) 249 })
...@@ -261,7 +267,7 @@ router.get('/school', function(req, res) { ...@@ -261,7 +267,7 @@ router.get('/school', function(req, res) {
261 let librarys = []; 267 let librarys = [];
262 for (let i = 0; i < library_result.Tbggibllbrm[1].row.length; i++) { 268 for (let i = 0; i < library_result.Tbggibllbrm[1].row.length; i++) {
263 library = library_result.Tbggibllbrm[1].row[i]; 269 library = library_result.Tbggibllbrm[1].row[i];
264 - if (userArea(library, 'REFINE_LOTNO_ADDR', user_dong)) { 270 + if (userArea(library, 'REFINE_LOTNO_ADDR', user_target)) {
265 console.log('library', library); 271 console.log('library', library);
266 librarys.push(library); 272 librarys.push(library);
267 } 273 }
...@@ -277,12 +283,12 @@ router.get('/school', function(req, res) { ...@@ -277,12 +283,12 @@ router.get('/school', function(req, res) {
277 let institutes = []; 283 let institutes = [];
278 for (let i = 0; i < institute_result.TninsttInstutM[1].row.length; i++) { 284 for (let i = 0; i < institute_result.TninsttInstutM[1].row.length; i++) {
279 institute = institute_result.TninsttInstutM[1].row[i]; 285 institute = institute_result.TninsttInstutM[1].row[i];
280 - if (userArea(institute, 'REFINE_LOTNO_ADDR', user_dong)) { 286 + if (userArea(institute, 'REFINE_LOTNO_ADDR', user_target)) {
281 console.log('institute', institute); 287 console.log('institute', institute);
282 institutes.push(institute); 288 institutes.push(institute);
283 } 289 }
284 } 290 }
285 - res.render('school_result', { librarys: librarys, institutes: institutes }); 291 + res.render('result', { category: 'school', librarys: librarys, institutes: institutes, userLocation: userLocation, grade: 'A' });
286 } 292 }
287 }) 293 })
288 } 294 }
...@@ -304,66 +310,57 @@ router.get('/park', function(req, res) { ...@@ -304,66 +310,57 @@ router.get('/park', function(req, res) {
304 let city_parks = []; 310 let city_parks = [];
305 for (let i = 0; i < city_park_result.CityPark[1].row.length; i++) { 311 for (let i = 0; i < city_park_result.CityPark[1].row.length; i++) {
306 city_park = city_park_result.CityPark[1].row[i]; 312 city_park = city_park_result.CityPark[1].row[i];
307 - if (userArea(city_park, 'REFINE_LOTNO_ADDR', user_dong)) { 313 + if (userArea(city_park, 'REFINE_LOTNO_ADDR', user_target)) {
308 city_parks.push(city_park); 314 city_parks.push(city_park);
309 } 315 }
310 } 316 }
311 - res.render('park_result', { city_parks: city_parks }); 317 + res.render('result', { category: 'park', city_parks: city_parks, userLocation: userLocation, grade: 'A' });
312 } 318 }
313 -
314 - // if (park_result.CityPark[0].head[1].RESULT.CODE == 'INFO-000') {
315 - // cityparknum = park_result.CityPark[0].head[0].list_total_count;
316 - // console.log(cityparknum + "개의 도시공원이 존재합니다.");
317 - // res.send(String(cityparknum) + "개의 도시공원이 존재합니다.");
318 - // } else {
319 - // res.send("도시공원이 없습니다.");
320 - // }
321 }) 319 })
322 }); 320 });
323 321
324 -router.get('/transport', function (req, res) { 322 +router.get('/transport', function(req, res) {
325 - let apikey=process.env.ODSAY_APIKEY 323 +
326 324
327 - let bus_url = 'https://api.odsay.com/v1/api/pointSearch?lang=0&x=' + user_latitude + '&y=' + user_logitude + '&radius=500&stationClass=1&apiKey=' + apikey; 325 + let bus_url = 'https://api.odsay.com/v1/api/pointSearch?';
328 - let subway_url = 'https://api.odsay.com/v1/api/pointSearch?lang=0&x=' + user_latitude + '&y=' + user_logitude + '&radius=1000&stationClass=2&apiKey=' + apikey; 326 + let subway_url = 'https://api.odsay.com/v1/api/pointSearch?';
327 + let qs = `?lang=0&x=${user_latitude}&y=${user_longitude}&radius=1000&stationClass=2&apiKey=${ODSAY_API_KEY}`;
329 let busCnt = 0; 328 let busCnt = 0;
330 - let subwayCnt=0; 329 + let subwayCnt = 0;
331 console.log(bus_url); 330 console.log(bus_url);
332 331
333 -
334 request({ 332 request({
335 - url: bus_url, 333 + url: bus_url + qs,
336 method: 'GET' 334 method: 'GET'
337 - }, function (err, response, body) { 335 + }, function(err, response, body) {
338 - 336 +
339 if (!err && res.statusCode == 200) { 337 if (!err && res.statusCode == 200) {
340 //console.log("inside"); 338 //console.log("inside");
341 let bus_result = JSON.parse(body); 339 let bus_result = JSON.parse(body);
342 - //console.log(bus_result); 340 + // console.log('bus_result', bus_result.result.station);
343 let busStations = []; 341 let busStations = [];
344 - busCnt = bus_result.result.count; 342 + console.log(bus_result.result)
345 - console.log('in!'); 343 + for (let i = 0; i < bus_result.result.station.length; i++) {
346 - for (var i = 0; i < busCnt; i++) { 344 + station = bus_result.result.station[i];
347 - busStations.push(bus_result.result.station[i].stationName); 345 + console.log('station', station)
346 + busStations.push(station);
348 } 347 }
349 - console.log(busStations); 348 + console.log('busStations', busStations);
350 request({ 349 request({
351 - url: subway_url, 350 + url: subway_url + qs,
352 method: 'GET' 351 method: 'GET'
353 - }, function (err, response, body) { 352 + }, function(err, response, body) {
354 if (!err && res.statusCode == 200) { 353 if (!err && res.statusCode == 200) {
355 let subway_result = JSON.parse(body); 354 let subway_result = JSON.parse(body);
356 let subwayStations = []; 355 let subwayStations = [];
357 - subwayCnt = subway_result.result.count; 356 + console.log('subway_result', subway_result);
358 - console.log("지하철역 개수:" + subwayCnt); 357 + for (let i = 0; i < subway_result.result.station.length; i++) {
359 - console.log('in3!'); 358 + station = subway_result.result.station[i];
360 - for (var i = 0; i < subwayCnt; i++) { 359 + subwayStations.push(station);
361 - console.log(subway_result.result.station[i]);
362 - subwayStations.push(subway_result.result.station[i].stationName);
363 } 360 }
364 console.log(busStations); 361 console.log(busStations);
365 - console.log(subwayStations); 362 + console.log('subwayStaions', subwayStations);
366 - res.render('transport',{busCnt:busCnt, busStations:busStations, subwayCnt:subwayCnt, subwayStations:subwayStations, total:busCnt+subwayCnt}) 363 + res.render('result', { category: 'transport', busStations: busStations, subwayStations: subwayStations, userLocation: userLocation, grade: 'A' })
367 } 364 }
368 }) 365 })
369 366
...@@ -371,7 +368,6 @@ router.get('/transport', function (req, res) { ...@@ -371,7 +368,6 @@ router.get('/transport', function (req, res) {
371 }) 368 })
372 369
373 }); 370 });
374 -
375 router.get('/safe', function(req, res) { 371 router.get('/safe', function(req, res) {
376 372
377 let cctv_url = 'https://openapi.gg.go.kr/CCTV'; 373 let cctv_url = 'https://openapi.gg.go.kr/CCTV';
...@@ -387,7 +383,7 @@ router.get('/safe', function(req, res) { ...@@ -387,7 +383,7 @@ router.get('/safe', function(req, res) {
387 console.log(cctv_result); 383 console.log(cctv_result);
388 for (let i = 0; i < cctv_result.CCTV[1].row.length; i++) { 384 for (let i = 0; i < cctv_result.CCTV[1].row.length; i++) {
389 cctv = cctv_result.CCTV[1].row[i]; 385 cctv = cctv_result.CCTV[1].row[i];
390 - if (userArea(cctv, 'REFINE_LOTNO_ADDR', user_dong)) { 386 + if (userArea(cctv, 'REFINE_LOTNO_ADDR', user_target)) {
391 console.log('cctv', cctv); 387 console.log('cctv', cctv);
392 cctvs.push(cctv); 388 cctvs.push(cctv);
393 } 389 }
...@@ -402,12 +398,12 @@ router.get('/safe', function(req, res) { ...@@ -402,12 +398,12 @@ router.get('/safe', function(req, res) {
402 console.log(light_result); 398 console.log(light_result);
403 for (let i = 0; i < light_result.SECRTLGT[1].row.length; i++) { 399 for (let i = 0; i < light_result.SECRTLGT[1].row.length; i++) {
404 light = light_result.SECRTLGT[1].row[i]; 400 light = light_result.SECRTLGT[1].row[i];
405 - if (userArea(light, 'REFINE_LOTNO_ADDR', user_dong)) { 401 + if (userArea(light, 'REFINE_LOTNO_ADDR', user_target)) {
406 console.log('light', light); 402 console.log('light', light);
407 lights.push(light); 403 lights.push(light);
408 } 404 }
409 } 405 }
410 - res.render('safe_result', { cctvs: cctvs, lights: lights }); 406 + res.render('result', { category: 'safe', cctvs: cctvs, lights: lights, userLocation: userLocation, grade: 'A' });
411 } 407 }
412 }) 408 })
413 } 409 }
...@@ -416,26 +412,26 @@ router.get('/safe', function(req, res) { ...@@ -416,26 +412,26 @@ router.get('/safe', function(req, res) {
416 }); 412 });
417 413
418 router.get('/culture', function(req, res) { 414 router.get('/culture', function(req, res) {
419 - // 노래방 415 + // 영화관
420 - let sing_url = 'https://openapi.gg.go.kr/Songclub'; 416 + let movie_url = 'https://openapi.gg.go.kr/MovieTheater';
421 let qs = `?Type=json&KEY=${GYEONGI_API_KEY}&SIGUN_CD=${SIGUN_CODE}`; 417 let qs = `?Type=json&KEY=${GYEONGI_API_KEY}&SIGUN_CD=${SIGUN_CODE}`;
422 request({ 418 request({
423 - url: sing_url + qs, 419 + url: movie_url + qs,
424 method: 'GET' 420 method: 'GET'
425 }, function(err, response, body) { 421 }, function(err, response, body) {
426 if (!err && res.statusCode == 200) { 422 if (!err && res.statusCode == 200) {
427 - let sing_result = JSON.parse(body); 423 + let movie_result = JSON.parse(body);
428 - console.log(sing_result); 424 + console.log(movie_result);
429 - let sings = []; 425 + let movies = [];
430 - for (let i = 0; i < sing_result.Songclub[1].row.length; i++) { 426 + for (let i = 0; i < movie_result.MovieTheater[1].row.length; i++) {
431 - sing = sing_result.Songclub[1].row[i]; 427 + movie = movie_result.MovieTheater[1].row[i];
432 // 폐업인 지점 제외 428 // 폐업인 지점 제외
433 - if (!sing['BSN_STATE_NM'].includes('폐업') && userArea(sing, 'REFINE_LOTNO_ADDR', user_dong)) { 429 + if (!movie['BSN_STATE_NM'].includes('폐업') && userArea(movie, 'REFINE_LOTNO_ADDR', user_target)) {
434 - console.log('sing', sing); 430 + console.log('movie', movie);
435 - sings.push(sing); 431 + movies.push(movie);
436 } 432 }
437 } 433 }
438 - res.render('culture_result', { sings: sings }); 434 + res.render('result', { category: 'culture', movies: movies, userLocation: userLocation, grade: 'A' });
439 } 435 }
440 }); 436 });
441 }); 437 });
...@@ -455,12 +451,12 @@ router.get('/shop', function(req, res) { ...@@ -455,12 +451,12 @@ router.get('/shop', function(req, res) {
455 for (let i = 0; i < shop_result.MrktStoreM[1].row.length; i++) { 451 for (let i = 0; i < shop_result.MrktStoreM[1].row.length; i++) {
456 shop = shop_result.MrktStoreM[1].row[i]; 452 shop = shop_result.MrktStoreM[1].row[i];
457 // 폐업인 지점 제외 453 // 폐업인 지점 제외
458 - if (userArea(shop, 'REFINE_LOTNO_ADDR', user_dong)) { 454 + if (userArea(shop, 'REFINE_LOTNO_ADDR', user_target)) {
459 console.log('shop', shop); 455 console.log('shop', shop);
460 shops.push(shop); 456 shops.push(shop);
461 } 457 }
462 } 458 }
463 - res.render('shop_result', { shops: shops }); 459 + res.render('result', { category: 'shop', shops: shops, userLocation: userLocation, grade: 'A' });
464 } 460 }
465 461
466 }) 462 })
...@@ -480,12 +476,12 @@ router.get('/gym', function(req, res) { ...@@ -480,12 +476,12 @@ router.get('/gym', function(req, res) {
480 for (let i = 0; i < gym_result.PhysicaFitnessTrainingPlace[1].row.length; i++) { 476 for (let i = 0; i < gym_result.PhysicaFitnessTrainingPlace[1].row.length; i++) {
481 gym = gym_result.PhysicaFitnessTrainingPlace[1].row[i]; 477 gym = gym_result.PhysicaFitnessTrainingPlace[1].row[i];
482 console.log(gym); 478 console.log(gym);
483 - if (userArea(gym, 'REFINE_LOTNO_ADDR', user_dong)) { 479 + if (userArea(gym, 'REFINE_LOTNO_ADDR', user_target)) {
484 console.log('gym', gym); 480 console.log('gym', gym);
485 gyms.push(gym); 481 gyms.push(gym);
486 } 482 }
487 } 483 }
488 - res.render('gym_result', { gyms: gyms }); 484 + res.render('result', { category: 'gym', gyms: gyms, userLocation: userLocation, grade: 'A' });
489 } 485 }
490 }) 486 })
491 }); 487 });
......
...@@ -10,70 +10,6 @@ ...@@ -10,70 +10,6 @@
10 <link rel='stylesheet' href='/css/category.css'> 10 <link rel='stylesheet' href='/css/category.css'>
11 11
12 <title>📝 결과</title> 12 <title>📝 결과</title>
13 - <h1>
14 - 🥘 맛집 현황</h1>
15 -<table class="table">
16 - <thead class="thead-dark">
17 - <tr>
18 - <th>음식점명</th>
19 - <th>전화번호</th>
20 - <th>대표음식</th>
21 - <th>도로명주소</th>
22 - </tr>
23 - </thead>
24 - <tbody>
25 - <%for (var i =0; i <stores.length; i++){%>
26 - <tr>
27 - <td>
28 - <%=stores[i].RESTRT_NM%>
29 - </td>
30 - <td>
31 - <%=stores[i].TASTFDPLC_TELNO%>
32 - </td>
33 - <td>
34 - <%=stores[i].REPRSNT_FOOD_NM%>
35 - </td>
36 - <td>
37 - <%=stores[i].REFINE_ROADNM_ADDR%>
38 - </td>
39 - </tr>
40 - <%}%>
41 - </tbody>
42 -</table>
43 -
44 -
45 -
46 -<h3>총 맛집 개수 :
47 - <%=stores.length%>
48 -</h3>
49 -
50 -
51 -<h1>🍔 패스트푸드점 현황 </h1>
52 -
53 -<table class="table">
54 - <thead class="thead-dark">
55 - <tr>
56 - <th>사업장명</th>
57 - <th>도로명주소</th>
58 - </tr>
59 - </thead>
60 - <tbody>
61 - <%for (var i =0; i <fast_food_stores.length; i++){%>
62 - <tr>
63 - <td>
64 - <%=fast_food_stores[i].BIZPLC_NM%>
65 - </td>
66 - <td>
67 - <%=fast_food_stores[i].REFINE_ROADNM_ADDR%>
68 - </td>
69 - </tr>
70 - <%}%>
71 - </tbody>
72 -</table>
73 -
74 -<h3>패스트푸드점 개수 :
75 - <%=fast_food_stores.length%>
76 -</h3>
77 </head> 13 </head>
78 14
79 <body> 15 <body>
......
1 <h1> 1 <h1>
2 🥘 맛집 현황</h1> 2 🥘 맛집 현황</h1>
3 +<table class="table">
3 <thead class="thead-dark"> 4 <thead class="thead-dark">
4 - <thead>
5 <tr> 5 <tr>
6 <th>음식점명</th> 6 <th>음식점명</th>
7 <th>전화번호</th> 7 <th>전화번호</th>
...@@ -29,13 +29,10 @@ ...@@ -29,13 +29,10 @@
29 </tbody> 29 </tbody>
30 </table> 30 </table>
31 31
32 -
33 -
34 <h3>총 맛집 개수 : 32 <h3>총 맛집 개수 :
35 <%=stores.length%> 33 <%=stores.length%>
36 </h3> 34 </h3>
37 35
38 -
39 <h1>🍔 패스트푸드점 현황 </h1> 36 <h1>🍔 패스트푸드점 현황 </h1>
40 37
41 <table class="table"> 38 <table class="table">
......