jimin

code fix

...@@ -6,6 +6,7 @@ var xmlToJson; ...@@ -6,6 +6,7 @@ var xmlToJson;
6 6
7 //var Dust_Month=0; 7 //var Dust_Month=0;
8 8
9 +var City;
9 var Feb_Dust_2018 =0 ; 10 var Feb_Dust_2018 =0 ;
10 var Mar_Dust_2018 =0 ; 11 var Mar_Dust_2018 =0 ;
11 var April_Dust_2018 =0 ; 12 var April_Dust_2018 =0 ;
...@@ -26,14 +27,18 @@ var url; ...@@ -26,14 +27,18 @@ var url;
26 const Dust_URL = "http://openAPI.seoul.go.kr:8088/" //미세먼지 api주소_1 27 const Dust_URL = "http://openAPI.seoul.go.kr:8088/" //미세먼지 api주소_1
27 const Dust_URL2 = "/xml/MonthlyAverageAirQuality/1/5/" //미세먼지 api주소_2 28 const Dust_URL2 = "/xml/MonthlyAverageAirQuality/1/5/" //미세먼지 api주소_2
28 const Dust_ServiceKey = "73754a53586a696d38345951716b6b" //Dust url의 key값 29 const Dust_ServiceKey = "73754a53586a696d38345951716b6b" //Dust url의 key값
29 -const Dust_Place ='/'+urlencode("강남구") //측정한 장소 30 +const Dust_Place = '/' + urlencode("강남구") //측정한 장소
31 +
32 +
30 33
31 //2020년 2월~6월 미세먼지 평균 34 //2020년 2월~6월 미세먼지 평균
32 function DelayNode_2020(item) 35 function DelayNode_2020(item)
33 { 36 {
34 return new Promise(function(resolve,reject){ 37 return new Promise(function(resolve,reject){
35 setTimeout(function(){ 38 setTimeout(function(){
39 + //Dust_Place ='/'+ City
36 url = Dust_URL+Dust_ServiceKey+Dust_URL2+item+Dust_Place; 40 url = Dust_URL+Dust_ServiceKey+Dust_URL2+item+Dust_Place;
41 + //console.log(url)
37 request(url,function(error,res,body) { 42 request(url,function(error,res,body) {
38 if(error){ 43 if(error){
39 console.log('error=>${error}'); 44 console.log('error=>${error}');
...@@ -78,6 +83,7 @@ function DelayNode_2019(item) ...@@ -78,6 +83,7 @@ function DelayNode_2019(item)
78 { 83 {
79 return new Promise(function(resolve,reject){ 84 return new Promise(function(resolve,reject){
80 setTimeout(function(){ 85 setTimeout(function(){
86 + //Dust_Place ='/'+ City
81 url = Dust_URL+Dust_ServiceKey+Dust_URL2+item+Dust_Place; 87 url = Dust_URL+Dust_ServiceKey+Dust_URL2+item+Dust_Place;
82 request(url,function(error,res,body) { 88 request(url,function(error,res,body) {
83 if(error){ 89 if(error){
...@@ -124,6 +130,7 @@ function DelayNode_2018(item) ...@@ -124,6 +130,7 @@ function DelayNode_2018(item)
124 { 130 {
125 return new Promise(function(resolve,reject){ 131 return new Promise(function(resolve,reject){
126 setTimeout(function(){ 132 setTimeout(function(){
133 + //Dust_Place ='/'+ City
127 url = Dust_URL+Dust_ServiceKey+Dust_URL2+item+Dust_Place; 134 url = Dust_URL+Dust_ServiceKey+Dust_URL2+item+Dust_Place;
128 request(url,function(error,res,body) { 135 request(url,function(error,res,body) {
129 if(error){ 136 if(error){
...@@ -167,6 +174,11 @@ Dust_Month_2018([201802,201803,201804,201805,201806]); ...@@ -167,6 +174,11 @@ Dust_Month_2018([201802,201803,201804,201805,201806]);
167 module.exports = function(app) 174 module.exports = function(app)
168 { 175 {
169 app.get('/',function(req,res){ 176 app.get('/',function(req,res){
177 + res.render('City_login')
178 + City = req.query.city;
179 + console.log(City)
180 + });
181 + app.get('/city',function(req,res){
170 res.render('index',{ 182 res.render('index',{
171 Feb_Dust_2018, 183 Feb_Dust_2018,
172 Mar_Dust_2018, 184 Mar_Dust_2018,
...@@ -185,7 +197,4 @@ module.exports = function(app) ...@@ -185,7 +197,4 @@ module.exports = function(app)
185 June_Dust_2020 197 June_Dust_2020
186 }) 198 })
187 }); 199 });
188 - app.get('/about',function(req,res){
189 - res.render('about.ejs');
190 - });
191 } 200 }
...\ No newline at end of file ...\ No newline at end of file
......