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
오수빈
2021-05-25 05:57:42 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
00d74f8631996089a0db5fae2548b53dab6e64c4
00d74f86
1 parent
3781dc06
parse xml to json
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
17 deletions
node_modules/xml-js/package.json
routes/category.js
node_modules/xml-js/package.json
View file @
00d74f8
{
"_from"
:
"xml-js"
,
"_from"
:
"xml-js
@^1.6.11
"
,
"_id"
:
"xml-js@1.6.11"
,
"_inBundle"
:
false
,
"_integrity"
:
"sha512-7rVi2KMfwfWFl+GpPg6m80IVMWXLRjO+PxTq7V2CDhoGak0wzYzFgUY2m4XJ47OGdXd8eLE8EmwfAmdjw7lC1g=="
,
"_location"
:
"/xml-js"
,
"_phantomChildren"
:
{},
"_requested"
:
{
"type"
:
"
tag
"
,
"type"
:
"
range
"
,
"registry"
:
true
,
"raw"
:
"xml-js"
,
"raw"
:
"xml-js
@^1.6.11
"
,
"name"
:
"xml-js"
,
"escapedName"
:
"xml-js"
,
"rawSpec"
:
""
,
"rawSpec"
:
"
^1.6.11
"
,
"saveSpec"
:
null
,
"fetchSpec"
:
"
latest
"
"fetchSpec"
:
"
^1.6.11
"
},
"_requiredBy"
:
[
"#USER"
,
...
...
@@ -21,7 +21,7 @@
],
"_resolved"
:
"https://registry.npmjs.org/xml-js/-/xml-js-1.6.11.tgz"
,
"_shasum"
:
"927d2f6947f7f1c19a316dd8eea3614e8b18f8e9"
,
"_spec"
:
"xml-js"
,
"_spec"
:
"xml-js
@^1.6.11
"
,
"_where"
:
"C:
\\
Users
\\
se051
\\
OneDrive
\\
바탕 화면
\\
나의 대학라이프
\\
오픈소스SW개발
\\
텀프
\\
animal-Info"
,
"author"
:
{
"name"
:
"Yousuf Almarzooqi"
,
...
...
routes/category.js
View file @
00d74f8
var
express
=
require
(
'express'
);
var
router
=
express
.
Router
();
var
request
=
require
(
'request'
);
var
convert
=
require
(
'xml-js'
).
parseString
;
const
convert
=
require
(
'xml-js'
)
;
require
(
'dotenv'
).
config
();
/* GET home page. */
...
...
@@ -14,17 +14,20 @@ let user_longitude;
router
.
get
(
'/hospital'
,
function
(
req
,
res
)
{
let
pet_url
=
`http://api.kcisa.kr/openapi/service/rest/convergence2019/getConver03?serviceKey=
${
ANIMAL_INFO_API_KEY
}
&numOfRows=10&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`
;
let
petOption
=
{
url
:
pet_url
,
method
:
'GET'
};
request
(
pet_url
,
function
(
err
,
response
,
body
){
if
(
err
){
console
.
log
(
err
)
}
console
.
log
(
body
)
res
.
send
(
"finish"
);
request
(
pet_url
,
function
(
err
,
response
,
body
){
if
(
err
)
{
console
.
log
(
`err =>
${
err
}
`
)
}
else
{
if
(
res
.
statusCode
==
200
)
{
var
result
=
body
;
console
.
log
(
`body data =>
${
result
}
`
);
var
xmlToJson
=
convert
.
xml2json
(
result
,
{
compact
:
true
,
spaces
:
4
});
console
.
log
(
`xml to json =>
${
xmlToJson
}
`
);
}
}
res
.
send
(
"finish"
);
})
});
...
...
Please
register
or
login
to post a comment