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-25 09:11:47 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
b94e514fcc2b8599b7e76a81d3693e3e7e30e039
b94e514f
2 parents
5e40dffa
a349c70b
Merge branch 'je' into 'main'
Je See merge request !10
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
10 deletions
emergency_api.js
emergency_api.js
View file @
b94e514
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/get
EmrrmRltmUsefulSckbd
InfoInqire'
;
var
url
=
'http://apis.data.go.kr/B552657/ErmctInfoInqireService/get
SrsillDissAceptncPosbl
InfoInqire'
;
var
queryParams
=
'?'
+
encodeURIComponent
(
'serviceKey'
)
+
'=52tXHgaW46YUpGn9k0r3IQrduIl6kBOl3Ta8Idra1%2BpPMYhL4qVCDu9itW8FVbDtMF4f9LAT9NJXEx7pvEJv%2FQ%3D%3D'
;
/* Service Key*/
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
(
'STAGE1'
)
+
'='
+
encodeURIComponent
(
'¼¿ïƯº°½Ã'
);
/* */
queryParams
+=
'&'
+
encodeURIComponent
(
'STAGE2'
)
+
'='
+
encodeURIComponent
(
'°³²±¸'
);
/* */
queryParams
+=
'&'
+
encodeURIComponent
(
'SM_TYPE'
)
+
'='
+
encodeURIComponent
(
''
);
/* */
queryParams
+=
'&'
+
encodeURIComponent
(
'pageNo'
)
+
'='
+
encodeURIComponent
(
'1'
);
/* */
queryParams
+=
'&'
+
encodeURIComponent
(
'numOfRows'
)
+
'='
+
encodeURIComponent
(
'10'
);
/* */
console
.
log
(
url
+
queryParams
);
request
({
url
:
url
+
queryParams
,
method
:
'GET'
...
...
@@ -23,10 +21,8 @@ request({
}
else
{
var
result
=
body
console
.
log
(
`body data =>
${
result
}
`
)
var
xmlTojson
=
convert
.
xml2json
(
result
,
{
compact
:
true
,
spaces
:
4
});
console
.
log
(
`xml to json =>
${
xmlTojson
}
`
)
var
xmlTojson
=
convert
.
xml2json
(
result
,
{
compact
:
true
,
spaces
:
1
});
console
.
log
(
xmlTojson
)
}
}
);
\ No newline at end of file
...
...
Please
register
or
login
to post a comment