Toggle navigation
Toggle navigation
This project
Loading...
Sign in
황지민
/
Corona_Dust
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
jimin
2020-06-24 01:37:46 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6441ad761f228aeedf28df09b53e372d58fa1ffc
6441ad76
1 parent
1d4bcad2
code fix
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
router/main.js
router/main.js
View file @
6441ad7
...
...
@@ -6,6 +6,7 @@ var xmlToJson;
//var Dust_Month=0;
var
City
;
var
Feb_Dust_2018
=
0
;
var
Mar_Dust_2018
=
0
;
var
April_Dust_2018
=
0
;
...
...
@@ -26,14 +27,18 @@ var url;
const
Dust_URL
=
"http://openAPI.seoul.go.kr:8088/"
//미세먼지 api주소_1
const
Dust_URL2
=
"/xml/MonthlyAverageAirQuality/1/5/"
//미세먼지 api주소_2
const
Dust_ServiceKey
=
"73754a53586a696d38345951716b6b"
//Dust url의 key값
const
Dust_Place
=
'/'
+
urlencode
(
"강남구"
)
//측정한 장소
const
Dust_Place
=
'/'
+
urlencode
(
"강남구"
)
//측정한 장소
//2020년 2월~6월 미세먼지 평균
function
DelayNode_2020
(
item
)
{
return
new
Promise
(
function
(
resolve
,
reject
){
setTimeout
(
function
(){
//Dust_Place ='/'+ City
url
=
Dust_URL
+
Dust_ServiceKey
+
Dust_URL2
+
item
+
Dust_Place
;
//console.log(url)
request
(
url
,
function
(
error
,
res
,
body
)
{
if
(
error
){
console
.
log
(
'error=>${error}'
);
...
...
@@ -78,6 +83,7 @@ function DelayNode_2019(item)
{
return
new
Promise
(
function
(
resolve
,
reject
){
setTimeout
(
function
(){
//Dust_Place ='/'+ City
url
=
Dust_URL
+
Dust_ServiceKey
+
Dust_URL2
+
item
+
Dust_Place
;
request
(
url
,
function
(
error
,
res
,
body
)
{
if
(
error
){
...
...
@@ -124,6 +130,7 @@ function DelayNode_2018(item)
{
return
new
Promise
(
function
(
resolve
,
reject
){
setTimeout
(
function
(){
//Dust_Place ='/'+ City
url
=
Dust_URL
+
Dust_ServiceKey
+
Dust_URL2
+
item
+
Dust_Place
;
request
(
url
,
function
(
error
,
res
,
body
)
{
if
(
error
){
...
...
@@ -167,6 +174,11 @@ Dust_Month_2018([201802,201803,201804,201805,201806]);
module
.
exports
=
function
(
app
)
{
app
.
get
(
'/'
,
function
(
req
,
res
){
res
.
render
(
'City_login'
)
City
=
req
.
query
.
city
;
console
.
log
(
City
)
});
app
.
get
(
'/city'
,
function
(
req
,
res
){
res
.
render
(
'index'
,{
Feb_Dust_2018
,
Mar_Dust_2018
,
...
...
@@ -185,7 +197,4 @@ module.exports = function(app)
June_Dust_2020
})
});
app
.
get
(
'/about'
,
function
(
req
,
res
){
res
.
render
(
'about.ejs'
);
});
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment