app.js 1.05 KB
const express = require("express");
const app = express();
const bodyParser = require('body-parser');
const request = require("request");
const router = express.Router();

let kakaoOptions = {
    url : "https://dapi.kakao.com/v2/local/search/keyword",
    method : "GET",
    headers : {
        'Authorization': 'KakaoAK 56e51abe725086bc9db03da986e47fed'
    },
    qs: {
        'query': 'CGV 광명',
        //'category_group_code' : 'CT1',
        'size' : 5
    },
    encoding : 'UTF-8'
};

request(kakaoOptions, function (err, res, body) {
    info_list = JSON.parse(body).documents;
    let selectable_theaters = [];
    if(!err && res.statusCode == 200){
        info_list.forEach(info => {
            if(info.category_name.endsWith("CGV")){
                const theater_info = {
                    "theater_name" : info.place_name,
                    "theater_url" : info.place_url
                };
                selectable_theaters.push(theater_info);
                //console.log(theater_info);
            }
        });
    }
});

module.exports = router;