Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source-group1
/
animal-Info
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
Eunsu486
2021-05-25 21:50:07 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
96b8af9388b5af5931110d907b01de5886882ea8
96b8af93
1 parent
f25fadfd
modify category.js
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
routes/category.js
routes/category.js
View file @
96b8af9
...
...
@@ -15,33 +15,33 @@ let hospital_list = [];
router
.
get
(
'/hospital'
,
function
(
req
,
res
)
{
//api
let
pet_url
=
`http://api.kcisa.kr/openapi/service/rest/convergence2019/getConver03?serviceKey=
${
ANIMAL_INFO_API_KEY
}
&numOfRows=100&pageNo=1&keyword=%EB%8F%99%EB%AC%BC%EB%B3%91%EC%9B%90&where=%EA%B0%95%EB%B6%81%EA%B5%AC`
;
request
(
pet_url
,
function
(
err
,
response
,
body
)
{
if
(
err
)
{
request
(
pet_url
,
function
(
err
,
response
,
body
)
{
if
(
err
)
{
console
.
log
(
`err =>
${
err
}
`
)
}
else
{
if
(
res
.
statusCode
==
200
)
{
var
result
=
convert
.
xml2json
(
body
,
{
compact
:
true
,
spaces
:
4
});
if
(
res
.
statusCode
==
200
)
{
var
result
=
convert
.
xml2json
(
body
,
{
compact
:
true
,
spaces
:
4
});
var
petJson
=
JSON
.
parse
(
result
)
var
itemList
=
petJson
.
response
.
body
.
items
;
var
numRows
=
itemList
.
item
.
length
;
//개수
for
(
i
=
0
;
i
<
numRows
;
i
++
)
{
for
(
i
=
0
;
i
<
numRows
;
i
++
)
{
// state 정상인 것만 추리기
if
(
itemList
.
item
[
i
].
state
.
_text
==
'정상'
){
if
(
itemList
.
item
[
i
].
state
.
_text
==
'정상'
)
{
hospital_list
.
push
(
itemList
.
item
[
i
]);
}
}
//테스트용 console.log
var
titles
=
''
;
for
(
i
=
0
;
i
<
hospital_list
.
length
;
i
++
)
{
titles
=
titles
+
hospital_list
[
i
].
title
.
_text
+
'\n'
;
for
(
i
=
0
;
i
<
hospital_list
.
length
;
i
++
)
{
titles
=
titles
+
hospital_list
[
i
].
title
.
_text
+
'\n'
;
}
console
.
log
(
titles
);
}
}
res
.
send
(
"finish"
);
})
});
});
module
.
exports
=
router
;
\ No newline at end of file
module
.
exports
=
router
;
\ No newline at end of file
...
...
Please
register
or
login
to post a comment