APIhandler.js 1.11 KB
let request = require('request');
let options = {
  'method': 'GET',
  'url': 'http://api.visitkorea.or.kr/openapi/service/rest/KorService/areaBasedList?ServiceKey=2lFkvQJYgzOOhwUKiUt8aZVNpd1PpBOf%2FfMNW17cl25DE0GUEDddeR9iGnuSUpggjUoIUgamfhcvnKQ3eH1dAw%3D%3D&contentTypeId=15&areaCode=&sigunguCode=&cat1=&cat2=&cat3=&listYN=Y&MobileOS=ETC&MobileApp=TourAPI3.0_Guide&arrange=A&numOfRows=12&pageNo=1&_type=json',
  'headers': {
  }
};
request(options, function (error, response, body) {
  if (error) {
      throw new Error(error);
  }
  let info = JSON.parse(body);

  for (i in info['response']['body']['items']['item']) {
      console.log('축제 : ' + info['response']['body']['items']['item'][i]['title']);
      console.log('축제 주소 : ' + info['response']['body']['items']['item'][i]['addr1']);
      console.log(
          '전화번호 : ' + info['response']['body']['items']['item'][i]['tel']
      );
      console.log('축제위도 : ' + info['response']['body']['items']['item'][i]['mapx']);
      console.log('축제경도 : ' + info['response']['body']['items']['item'][i]['mapy']);
      console.log(" ")
  }
});