Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김대연
/
emergency_room_ChatBot
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
김시환
2022-11-24 16:06:46 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
5e40dffa9ec2267bb54a3df8f4796cb231785c2e
5e40dffa
2 parents
a14da936
e656946c
Merge branch 'je' into 'main'
modify emergency_api.js See merge request !9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
emergency_api.js
emergency_api.js
View file @
5e40dff
const
{
query
}
=
require
(
'express'
);
const
express
=
require
(
'express'
);
const
app
=
express
();
const
request
=
require
(
'request'
);
const
convert
=
require
(
"xml-js"
);
var
url
=
'http://apis.data.go.kr/B552657/ErmctInfoInqireService/getEmrrmRltmUsefulSckbdInfoInqire'
;
var
queryParams
=
'?'
+
encodeURIComponent
(
'serviceKey'
)
+
'=52tXHgaW46YUpGn9k0r3IQrduIl6kBOl3Ta8Idra1%2BpPMYhL4qVCDu9itW8FVbDtMF4f9LAT9NJXEx7pvEJv%2FQ%3D%3D'
;
/* Service Key*/
queryParams
+=
'&'
+
encodeURIComponent
(
'STAGE1'
)
+
'='
+
encodeURIComponent
(
'¼¿ïƯº°½Ã'
);
/* */
queryParams
+=
'&'
+
encodeURIComponent
(
'STAGE2'
)
+
'='
+
encodeURIComponent
(
'°³²±¸'
);
/* */
queryParams
+=
'&'
+
encodeURIComponent
(
'STAGE1'
)
+
'='
+
'%EC%84%9C%EC%9A%B8%ED%8A%B9%EB%B3%84%EC%8B%9C'
;
/* */
queryParams
+=
'&'
+
encodeURIComponent
(
'STAGE2'
)
+
'='
+
'%EA%B0%95%EB%82%A8%EA%B5%AC'
;
/* */
queryParams
+=
'&'
+
encodeURIComponent
(
'pageNo'
)
+
'='
+
encodeURIComponent
(
'1'
);
/* */
queryParams
+=
'&'
+
encodeURIComponent
(
'numOfRows'
)
+
'='
+
encodeURIComponent
(
'10'
);
/* */
console
.
log
(
url
+
queryParams
);
request
({
url
:
url
+
queryParams
,
method
:
'GET'
...
...
@@ -15,5 +21,12 @@ request({
if
(
err
){
console
.
log
(
`err =>
${
err
}
`
)
}
console
.
log
(
convert
.
xml2js
(
body
));
});
\ No newline at end of file
else
{
var
result
=
body
console
.
log
(
`body data =>
${
result
}
`
)
var
xmlTojson
=
convert
.
xml2json
(
result
,
{
compact
:
true
,
spaces
:
4
});
console
.
log
(
`xml to json =>
${
xmlTojson
}
`
)
}
}
);
\ No newline at end of file
...
...
Please
register
or
login
to post a comment