ShinSeungMin

Add get rank feature

...@@ -18,23 +18,29 @@ let date = year + month + day-1; ...@@ -18,23 +18,29 @@ let date = year + month + day-1;
18 //console.log(date); 18 //console.log(date);
19 19
20 let key = "b70513efc156d7b826bb8dc98ff2f1cf"; 20 let key = "b70513efc156d7b826bb8dc98ff2f1cf";
21 -let url = "http://kobis.or.kr/kobisopenapi/webservice/rest/boxoffice/searchDailyBoxOfficeList.json?key=" + key + "&targetDt="; 21 +let url = "http://kobis.or.kr/kobisopenapi/webservice/rest/boxoffice/searchDailyBoxOfficeList.json?key=" + key + "&targetDt=" + date + "&itemPerPage=";
22 -let rank = 5 22 +//let rank = 5
23 -// apiurl = url + date + "&itemPerPage=" +rank-> "출력할 박스오피스 순위(5: 5위 까지, 10 : 10위 까지.../기본, 최대 10)" 23 +//apiurl = url + date + "&itemPerPage=" +rank-> "출력할 박스오피스 순위(5: 5위 까지, 10 : 10위 까지.../기본, 최대 10)"
24 //console.log(url); 24 //console.log(url);
25 25
26 let options = { 26 let options = {
27 'method' : 'GET', 27 'method' : 'GET',
28 - 'url' : url + date + "&itemPerPage=" + rank 28 + 'url' : url // + rank
29 }; 29 };
30 30
31 -request(options, function (error, response, body){ 31 +
32 - if (error){ 32 +
33 - throw new Error(error); 33 +app.get('/BoxOffice',(req, res) => {
34 - } 34 + options.url = url + req.body.rank;
35 - let info = JSON.parse(body); 35 + //console.log(req.body.rank);
36 - console.log(info); 36 + request(options, function (error, response, body){
37 -}); 37 + if (error){
38 + throw new Error(error);
39 + }
40 + let info = JSON.parse(body);
41 + res.send(info);
42 + });
43 +})
38 44
39 // 박스오피스 순위 출력 45 // 박스오피스 순위 출력
40 46
......