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 06:58:33 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1de5514a1011ccea2ec5d50b91883eb96a9718e0
1de5514a
1 parent
32290804
Complete safe category
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
10 deletions
routes/category.js
views/safe_result.ejs
routes/category.js
View file @
1de5514
...
...
@@ -293,6 +293,52 @@ router.get('/park', function(req, res) {
})
});
router
.
get
(
'/transport'
,
function
(
req
,
res
)
{
res
.
send
(
BusCnt
);
});
router
.
get
(
'/safe'
,
function
(
req
,
res
)
{
let
cctv_url
=
'https://openapi.gg.go.kr/CCTV'
;
let
light_url
=
'https://openapi.gg.go.kr/SECRTLGT'
let
qs
=
`?Type=json&KEY=
${
GYEONGI_API_KEY
}
&SIGUN_CD=
${
SIGUN_CODE
}
`
;
request
({
url
:
cctv_url
+
qs
,
method
:
'GET'
},
function
(
err
,
response
,
body
)
{
if
(
!
err
&&
res
.
statusCode
==
200
)
{
let
cctv_result
=
JSON
.
parse
(
body
);
let
cctvs
=
[];
console
.
log
(
cctv_result
);
for
(
let
i
=
0
;
i
<
cctv_result
.
CCTV
[
1
].
row
.
length
;
i
++
)
{
cctv
=
cctv_result
.
CCTV
[
1
].
row
[
i
];
console
.
log
(
'cctv'
,
cctv
);
cctvs
.
push
(
cctv
);
}
request
({
url
:
light_url
+
qs
,
method
:
'GET'
},
function
(
err
,
response
,
body
)
{
if
(
!
err
&&
res
.
statusCode
==
200
)
{
let
light_result
=
JSON
.
parse
(
body
);
let
lights
=
[];
console
.
log
(
light_result
);
for
(
let
i
=
0
;
i
<
light_result
.
SECRTLGT
[
1
].
row
.
length
;
i
++
)
{
light
=
light_result
.
SECRTLGT
[
1
].
row
[
i
];
console
.
log
(
'light'
,
light
);
lights
.
push
(
light
);
}
res
.
render
(
'safe_result'
,
{
cctvs
:
cctvs
,
lights
:
lights
});
}
})
}
})
});
router
.
get
(
'/culture'
,
function
(
req
,
res
)
{
res
.
send
(
'This is culture'
);
});
router
.
get
(
'/shop'
,
function
(
req
,
res
)
{
let
mallnum
=
0
;
...
...
@@ -312,7 +358,6 @@ router.get('/shop', function(req, res) {
shops
.
push
(
shop
);
}
res
.
render
(
'shop_result'
,
{
shops
:
shops
});
}
// var shop_result = JSON.parse(body);
// if (shop_result.MrktStoreM[0].head[1].RESULT.CODE == 'INFO-000') {
...
...
@@ -356,15 +401,6 @@ router.get('/gym', function(req, res) {
// }
})
});
router
.
get
(
'/transport'
,
function
(
req
,
res
)
{
res
.
send
(
BusCnt
);
});
router
.
get
(
'/safe'
,
function
(
req
,
res
)
{
res
.
send
(
'This is safe'
);
});
router
.
get
(
'/culture'
,
function
(
req
,
res
)
{
res
.
send
(
'This is culture'
);
});
module
.
exports
=
router
;
\ No newline at end of file
...
...
views/safe_result.ejs
0 → 100644
View file @
1de5514
<!DOCTYPE html>
<html
lang=
"ko"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
✍️ 결과 페이지
</title>
</head>
<body>
<h1>
📷 CCTV 현황
</h1>
CCTV 소재지 지번주소 :
<
%for (var i =0; i
<cctvs
.
length
;
i
++){%
>
<li>
<
%=cctvs[i].REFINE_LOTNO_ADDR%>
</li>
<
%}%>
<h3>
총 CCTV 개수 :
<
%=cctvs.length%>
</h3>
<h1>
💡 보안등 현황
</h1>
보안등 소재지 지번주소 :
<
%for (var i =0; i
<lights
.
length
;
i
++){%
>
<li>
<
%=lights[i].REFINE_LOTNO_ADDR%>
</li>
<
%}%>
<h3>
총 보안등 개수 :
<
%=lights.length%>
</h3>
</body>
</html>
\ No newline at end of file
Please
register
or
login
to post a comment