Toggle navigation
Toggle navigation
This project
Loading...
Sign in
term-project
/
project
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
Solhee
2020-12-04 01:29:54 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f45fe5f31884c0e7c83900ba4b23394b95ee8495
f45fe5f3
1 parent
b9be4bdc
foodapi_rawmaterial
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
express/foodapi_rawmaterial.js
express/foodapi_rawmaterial.js
0 → 100644
View file @
f45fe5f
// 식품의약품 안전처 품목제조보고(원재료) API 요청 예시입니다
var
express
=
require
(
'express'
);
var
request
=
require
(
'request'
);
var
url
=
'http://openapi.foodsafetykorea.go.kr/api'
;
var
key
=
'인증키'
;
// 12월03일 신청하였습니다.
var
filetype
=
'json'
;
var
startIndex
=
1
;
var
endIndex
=
5
;
var
NameOfProduct
=
'해오름다시마간장'
;
// 제품명 넣는 자리
var
queryParams
=
'/'
+
key
;
queryParams
+=
'/'
+
encodeURIComponent
(
'C002'
);
queryParams
+=
'/'
+
encodeURIComponent
(
filetype
);
queryParams
+=
'/'
+
encodeURIComponent
(
'startIdx'
)
+
'='
+
encodeURIComponent
(
startIndex
);
queryParams
+=
'/'
+
encodeURIComponent
(
'endIdx'
)
+
'='
+
encodeURIComponent
(
endIndex
);
queryParams
+=
'&'
+
encodeURIComponent
(
'PRDLST_NM'
)
+
'='
+
encodeURIComponent
(
'제품명'
);
request
({
url
:
url
+
queryParams
,
method
:
'GET'
},
function
(
error
,
response
,
body
)
{
if
(
error
){
console
.
log
(
'에러입니다.'
)
}
else
{
if
(
response
.
statusCode
==
200
){
var
result
=
body
;
var
resObj
=
eval
(
"("
+
result
+
")"
);
console
.
log
(
result
);
}
}
});
Please
register
or
login
to post a comment