Toggle navigation
Toggle navigation
This project
Loading...
Sign in
zuzitsu
/
UR_Village
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Suyeon Jung
2020-12-07 05:07:48 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c8e5c1235112b1134c7a6303e9ab8ee754cad87c
c8e5c123
1 parent
9363f32e
Complete food category
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletions
routes/category.js
views/result.ejs
routes/category.js
View file @
c8e5c12
...
...
@@ -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
});
}
})
}
});
});
...
...
views/result.ejs
View file @
c8e5c12
...
...
@@ -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>
...
...
Please
register
or
login
to post a comment