박주영

조금 수정

...@@ -8,9 +8,9 @@ var url = 'http://apis.data.go.kr/1470000/FoodAdtvInfoService/getFoodAdtvInfoLis ...@@ -8,9 +8,9 @@ var url = 'http://apis.data.go.kr/1470000/FoodAdtvInfoService/getFoodAdtvInfoLis
8 var key ='ofY2ppOq5kBqT5jYPaGsW%2BEy7OR5a1bf5Z9PHvqNKvwO5DSCaU2x2qCj%2FoXnuB1YVbMTlErkHWSMEsR5b7isrw%3D%3D'; 8 var key ='ofY2ppOq5kBqT5jYPaGsW%2BEy7OR5a1bf5Z9PHvqNKvwO5DSCaU2x2qCj%2FoXnuB1YVbMTlErkHWSMEsR5b7isrw%3D%3D';
9 var queryParams = '?' + encodeURIComponent('ServiceKey') + '=' +key; 9 var queryParams = '?' + encodeURIComponent('ServiceKey') + '=' +key;
10 //queryParams += '&' + encodeURIComponent('prdlst_cd') + '=' + encodeURIComponent('C0118010300000'); 10 //queryParams += '&' + encodeURIComponent('prdlst_cd') + '=' + encodeURIComponent('C0118010300000');
11 -queryParams += '&' + encodeURIComponent('pc_kor_nm') + '=' + encodeURIComponent('스위트초콜릿'); 11 +queryParams += '&' + encodeURIComponent('pc_kor_nm');// + '=' + encodeURIComponent('스위트초콜릿');
12 -//queryParams += '&' + encodeURIComponent('pageNo') + '=' + encodeURIComponent('3'); 12 +queryParams += '&' + encodeURIComponent('pageNo') + '=' + encodeURIComponent('213');
13 -//queryParams += '&' + encodeURIComponent('numOfRows') + '=' + encodeURIComponent('100'); 13 +queryParams += '&' + encodeURIComponent('numOfRows') + '=' + encodeURIComponent('100');
14 14
15 global.foods = new Array(); 15 global.foods = new Array();
16 16
...@@ -29,16 +29,19 @@ request({ ...@@ -29,16 +29,19 @@ request({
29 //console.log(xmltojson); 29 //console.log(xmltojson);
30 var resObj = eval("("+xmltojson+")"); 30 var resObj = eval("("+xmltojson+")");
31 var resultItems = resObj.response.body.items; 31 var resultItems = resObj.response.body.items;
32 - console.log(xmltojson); 32 + //console.log(xmltojson);
33 - var responseMessage ='[ ' + resultItems.item[0].PC_KOR_NM._text + ' ]\n'; 33 +
34 34
35 35
36 for(var i=0 ; i < resultItems.item.length; i ++){ 36 for(var i=0 ; i < resultItems.item.length; i ++){
37 + var responseMessage ='[ ' + resultItems.item[i].PC_KOR_NM._text + ' ]\n';
37 var addictive = resultItems.item[i].T_KOR_NM._text; 38 var addictive = resultItems.item[i].T_KOR_NM._text;
38 var specVal = resultItems.item[i].SPEC_VAL_SUMUP._text; 39 var specVal = resultItems.item[i].SPEC_VAL_SUMUP._text;
39 - responseMessage += addictive + ' : ' + specVal + '\n'; 40 + var yn = resultItems.item[i].INJRY_YN._text;
41 + responseMessage += addictive + ' : ' + specVal + '['+yn+']'+ '\n';
42 + console.log('[responese message]',responseMessage);
40 } 43 }
41 - console.log('[responese message]',responseMessage); 44 +
42 } 45 }
43 } 46 }
44 //console.log('Status', response.statusCode); 47 //console.log('Status', response.statusCode);
......