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){
...@@ -165,27 +172,29 @@ async function Dust_Month_2018(Dust_Month_2018){ ...@@ -165,27 +172,29 @@ async function Dust_Month_2018(Dust_Month_2018){
165 Dust_Month_2018([201802,201803,201804,201805,201806]); 172 Dust_Month_2018([201802,201803,201804,201805,201806]);
166 173
167 module.exports = function(app) 174 module.exports = function(app)
168 -{ 175 +{
169 - app.get('/',function(req,res){ 176 + app.get('/',function(req,res){
170 - res.render('index',{ 177 + res.render('City_login')
171 - Feb_Dust_2018, 178 + City = req.query.city;
172 - Mar_Dust_2018, 179 + console.log(City)
173 - April_Dust_2018, 180 + });
174 - May_Dust_2018, 181 + app.get('/city',function(req,res){
175 - June_Dust_2018, 182 + res.render('index',{
176 - Feb_Dust_2019, 183 + Feb_Dust_2018,
177 - Mar_Dust_2019, 184 + Mar_Dust_2018,
178 - April_Dust_2019, 185 + April_Dust_2018,
179 - May_Dust_2019, 186 + May_Dust_2018,
180 - June_Dust_2019, 187 + June_Dust_2018,
181 - Feb_Dust_2020, 188 + Feb_Dust_2019,
182 - Mar_Dust_2020, 189 + Mar_Dust_2019,
183 - April_Dust_2020, 190 + April_Dust_2019,
184 - May_Dust_2020, 191 + May_Dust_2019,
185 - June_Dust_2020 192 + June_Dust_2019,
186 - }) 193 + Feb_Dust_2020,
187 - }); 194 + Mar_Dust_2020,
188 - app.get('/about',function(req,res){ 195 + April_Dust_2020,
189 - res.render('about.ejs'); 196 + May_Dust_2020,
190 - }); 197 + June_Dust_2020
198 + })
199 + });
191 } 200 }
...\ No newline at end of file ...\ No newline at end of file
......