Toggle navigation
Toggle navigation
This project
Loading...
Sign in
조민지
/
2018_2_project
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
배희수
2018-12-09 16:34:22 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b733ef5c1fdce1174b38b94441cab0b012a3b0c3
b733ef5c
1 parent
f107c0cb
패키지 파일 오류 및 DB 쿼리문/변수명 수정
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
86 additions
and
86 deletions
package-lock.json
package.json
routes/index.js
package-lock.json
View file @
b733ef5
...
...
@@ -23,10 +23,10 @@
"resolved"
:
"https://registry.npmjs.org/ajv/-/ajv-6.6.1.tgz"
,
"integrity"
:
"sha512-ZoJjft5B+EJBjUyu9C9Hc0OZyPZSSlOF+plzouTrg6UlA8f+e/n8NIgBFG/9tppJtpPWfthHakK7juJdNDODww=="
,
"requires"
:
{
"fast-deep-equal"
:
"2.0.1"
,
"fast-json-stable-stringify"
:
"2.0.0"
,
"json-schema-traverse"
:
"0.4.1"
,
"uri-js"
:
"4.2.2"
"fast-deep-equal"
:
"
^
2.0.1"
,
"fast-json-stable-stringify"
:
"
^
2.0.0"
,
"json-schema-traverse"
:
"
^
0.4.1"
,
"uri-js"
:
"
^
4.2.2"
}
},
"array-flatten"
:
{
...
...
@@ -44,7 +44,7 @@
"resolved"
:
"https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz"
,
"integrity"
:
"sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg=="
,
"requires"
:
{
"safer-buffer"
:
"
2.1.2
"
"safer-buffer"
:
"
~2.1.0
"
}
},
"assert-plus"
:
{
...
...
@@ -100,7 +100,7 @@
"resolved"
:
"https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz"
,
"integrity"
:
"sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4="
,
"requires"
:
{
"tweetnacl"
:
"
0.14.5
"
"tweetnacl"
:
"
^0.14.3
"
}
},
"better-assert"
:
{
...
...
@@ -163,7 +163,7 @@
"resolved"
:
"https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz"
,
"integrity"
:
"sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w=="
,
"requires"
:
{
"delayed-stream"
:
"1.0.0"
"delayed-stream"
:
"
~
1.0.0"
}
},
"component-bind"
:
{
...
...
@@ -247,7 +247,7 @@
"resolved"
:
"https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz"
,
"integrity"
:
"sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA="
,
"requires"
:
{
"assert-plus"
:
"1.0.0"
"assert-plus"
:
"
^
1.0.0"
}
},
"dasherize"
:
{
...
...
@@ -255,6 +255,11 @@
"resolved"
:
"https://registry.npmjs.org/dasherize/-/dasherize-2.0.0.tgz"
,
"integrity"
:
"sha1-bYCcnNDPe7iVLYD8hPoT1H3bEwg="
},
"date-utils"
:
{
"version"
:
"1.2.21"
,
"resolved"
:
"https://registry.npmjs.org/date-utils/-/date-utils-1.2.21.tgz"
,
"integrity"
:
"sha1-YfsWzcEnSzyayq/+n8ad+HIKK2Q="
},
"debug"
:
{
"version"
:
"2.6.9"
,
"resolved"
:
"https://registry.npmjs.org/debug/-/debug-2.6.9.tgz"
,
...
...
@@ -293,8 +298,8 @@
"resolved"
:
"https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz"
,
"integrity"
:
"sha1-OoOpBOVDUyh4dMVkt1SThoSamMk="
,
"requires"
:
{
"jsbn"
:
"
0.1.1
"
,
"safer-buffer"
:
"
2.1.2
"
"jsbn"
:
"
~0.1.0
"
,
"safer-buffer"
:
"
^2.1.0
"
}
},
"ee-first"
:
{
...
...
@@ -490,9 +495,9 @@
"resolved"
:
"https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz"
,
"integrity"
:
"sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ=="
,
"requires"
:
{
"asynckit"
:
"0.4.0"
,
"combined-stream"
:
"
1.0.7
"
,
"mime-types"
:
"
2.1.21
"
"asynckit"
:
"
^
0.4.0"
,
"combined-stream"
:
"
^1.0.6
"
,
"mime-types"
:
"
^2.1.12
"
}
},
"forwarded"
:
{
...
...
@@ -515,7 +520,7 @@
"resolved"
:
"https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz"
,
"integrity"
:
"sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo="
,
"requires"
:
{
"assert-plus"
:
"1.0.0"
"assert-plus"
:
"
^
1.0.0"
}
},
"har-schema"
:
{
...
...
@@ -528,8 +533,8 @@
"resolved"
:
"https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz"
,
"integrity"
:
"sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g=="
,
"requires"
:
{
"ajv"
:
"
6.6.1
"
,
"har-schema"
:
"2.0.0"
"ajv"
:
"
^6.5.5
"
,
"har-schema"
:
"
^
2.0.0"
}
},
"has-binary2"
:
{
...
...
@@ -613,9 +618,9 @@
"resolved"
:
"https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz"
,
"integrity"
:
"sha1-muzZJRFHcvPZW2WmCruPfBj7rOE="
,
"requires"
:
{
"assert-plus"
:
"1.0.0"
,
"jsprim"
:
"
1.4.1
"
,
"sshpk"
:
"
1.15.2
"
"assert-plus"
:
"
^
1.0.0"
,
"jsprim"
:
"
^1.2.2
"
,
"sshpk"
:
"
^1.7.0
"
}
},
"iconv-lite"
:
{
...
...
@@ -898,26 +903,26 @@
"resolved"
:
"https://registry.npmjs.org/request/-/request-2.88.0.tgz"
,
"integrity"
:
"sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg=="
,
"requires"
:
{
"aws-sign2"
:
"0.7.0"
,
"aws4"
:
"1.8.0"
,
"caseless"
:
"0.12.0"
,
"combined-stream"
:
"
1.0.7
"
,
"extend"
:
"3.0.2"
,
"forever-agent"
:
"0.6.1"
,
"form-data"
:
"
2.3.3
"
,
"har-validator"
:
"
5.1.3
"
,
"http-signature"
:
"1.2.0"
,
"is-typedarray"
:
"1.0.0"
,
"isstream"
:
"0.1.2"
,
"json-stringify-safe"
:
"5.0.1"
,
"mime-types"
:
"
2.1.21
"
,
"oauth-sign"
:
"0.9.0"
,
"performance-now"
:
"2.1.0"
,
"qs"
:
"6.5.2"
,
"safe-buffer"
:
"5.1.2"
,
"tough-cookie"
:
"2.4.3"
,
"tunnel-agent"
:
"0.6.0"
,
"uuid"
:
"3.3.2"
"aws-sign2"
:
"
~
0.7.0"
,
"aws4"
:
"
^
1.8.0"
,
"caseless"
:
"
~
0.12.0"
,
"combined-stream"
:
"
~1.0.6
"
,
"extend"
:
"
~
3.0.2"
,
"forever-agent"
:
"
~
0.6.1"
,
"form-data"
:
"
~2.3.2
"
,
"har-validator"
:
"
~5.1.0
"
,
"http-signature"
:
"
~
1.2.0"
,
"is-typedarray"
:
"
~
1.0.0"
,
"isstream"
:
"
~
0.1.2"
,
"json-stringify-safe"
:
"
~
5.0.1"
,
"mime-types"
:
"
~2.1.19
"
,
"oauth-sign"
:
"
~
0.9.0"
,
"performance-now"
:
"
^
2.1.0"
,
"qs"
:
"
~
6.5.2"
,
"safe-buffer"
:
"
^
5.1.2"
,
"tough-cookie"
:
"
~
2.4.3"
,
"tunnel-agent"
:
"
^
0.6.0"
,
"uuid"
:
"
^
3.3.2"
}
},
"safe-buffer"
:
{
...
...
@@ -1057,25 +1062,26 @@
}
}
},
"sqlstring"
:
{
"version"
:
"2.3.1"
,
"resolved"
:
"https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz"
,
"integrity"
:
"sha1-R1OT/56RR5rqYtyvDKPRSYOn+0A="
},
"sshpk"
:
{
"version"
:
"1.15.2"
,
"resolved"
:
"https://registry.npmjs.org/sshpk/-/sshpk-1.15.2.tgz"
,
"integrity"
:
"sha512-Ra/OXQtuh0/enyl4ETZAfTaeksa6BXks5ZcjpSUNrjBr0DvrJKX+1fsKDPpT9TBXgHAFsa4510aNVgI8g/+SzA=="
,
"requires"
:
{
"asn1"
:
"0.2.4"
,
"assert-plus"
:
"1.0.0"
,
"bcrypt-pbkdf"
:
"1.0.2"
,
"dashdash"
:
"1.14.1"
,
"ecc-jsbn"
:
"0.1.2"
,
"getpass"
:
"0.1.7"
,
"jsbn"
:
"0.1.1"
,
"safer-buffer"
:
"2.1.2"
,
"tweetnacl"
:
"0.14.5"
},
"sqlstring"
:
{
"version"
:
"2.3.1"
,
"resolved"
:
"https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz"
,
"integrity"
:
"sha1-R1OT/56RR5rqYtyvDKPRSYOn+0A="
"asn1"
:
"~0.2.3"
,
"assert-plus"
:
"^1.0.0"
,
"bcrypt-pbkdf"
:
"^1.0.0"
,
"dashdash"
:
"^1.12.0"
,
"ecc-jsbn"
:
"~0.1.1"
,
"getpass"
:
"^0.1.1"
,
"jsbn"
:
"~0.1.0"
,
"safer-buffer"
:
"^2.0.2"
,
"tweetnacl"
:
"~0.14.0"
}
},
"statuses"
:
{
"version"
:
"1.5.0"
,
...
...
@@ -1100,8 +1106,8 @@
"resolved"
:
"https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz"
,
"integrity"
:
"sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ=="
,
"requires"
:
{
"psl"
:
"
1.1.29
"
,
"punycode"
:
"1.4.1"
"psl"
:
"
^1.1.24
"
,
"punycode"
:
"
^
1.4.1"
},
"dependencies"
:
{
"punycode"
:
{
...
...
@@ -1116,7 +1122,7 @@
"resolved"
:
"https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz"
,
"integrity"
:
"sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0="
,
"requires"
:
{
"safe-buffer"
:
"
5.1.2
"
"safe-buffer"
:
"
^5.0.1
"
}
},
"tweetnacl"
:
{
...
...
@@ -1143,7 +1149,8 @@
"resolved"
:
"https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz"
,
"integrity"
:
"sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ=="
,
"requires"
:
{
"punycode"
:
"2.1.1"
"punycode"
:
"^2.1.0"
}
},
"util-deprecate"
:
{
"version"
:
"1.0.2"
,
...
...
@@ -1170,9 +1177,9 @@
"resolved"
:
"https://registry.npmjs.org/verror/-/verror-1.10.0.tgz"
,
"integrity"
:
"sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA="
,
"requires"
:
{
"assert-plus"
:
"1.0.0"
,
"assert-plus"
:
"
^
1.0.0"
,
"core-util-is"
:
"1.0.2"
,
"extsprintf"
:
"
1.3
.0"
"extsprintf"
:
"
^1.2
.0"
}
},
"ws"
:
{
...
...
package.json
View file @
b733ef5
...
...
@@ -9,14 +9,15 @@
"body-parser"
:
"^1.18.3"
,
"compression"
:
"^1.7.3"
,
"cookie-parser"
:
"~1.4.3"
,
"date-utils"
:
"^1.2.21"
,
"debug"
:
"~2.6.9"
,
"ejs"
:
"~2.5.7"
,
"express"
:
"~4.16.0"
,
"helmet"
:
"^3.13.0"
,
"http-errors"
:
"~1.6.2"
,
"morgan"
:
"~1.9.0"
,
"request"
:
"^2.88.0"
,
"mysql"
:
"^2.16.0"
,
"request"
:
"^2.88.0"
,
"socket.io"
:
"^2.1.1"
}
}
...
...
routes/index.js
View file @
b733ef5
var
express
=
require
(
'express'
);
var
router
=
express
.
Router
();
var
db
=
require
(
'../lib/db'
)
var
db
=
require
(
'../lib/db'
)
;
/* GET home page. */
router
.
get
(
'/'
,
function
(
req
,
res
,
next
)
{
// 자외선지수, 불쾌지수, 열지수, 체감 온도, 바람속도, 현재기온, 하늘 상태, 강우량, 태풍, 낙뢰
var
uvr
,
discomfort
,
heat
,
sensibleTem
,
windSpeed
,
presentTem
,
skyState
,
rainfall
,
typhoon
,
lightning
;
// 사망 확률
var
deathProb
;
// 자외선지수, 불쾌지수, 열지수, 체감 온도, 바람속도, 현재기온, 하늘 상태, 강우량, 태풍, 낙뢰, 특보, 현재 시간
var
uvr
,
discomfort
,
heat
,
sensibleTem
,
windSpeed
,
presentTem
,
skyState
,
rainfall
,
typhoon
,
lightning
,
alert
,
time
;
// 쿼리문
var
sql
=
'SELECT * FROM kkonzi_test.weatherInfo'
;
var
sql
=
'SELECT * FROM kkonzi_test.weatherInfo
WHERE kkonzi_test.time > DATE_FORMAT(DATE_ADD(now(), INTERVAL -1 MINUTE), "%Y-%m-%d %H:%i:%s")'
';
db.query(sql, function(err, rows, fields){
if (err) {
console.log(err);
} else {
if (rows.length == 0){
}
else {
}
var tmp = rows.length - 1;
uvr
=
rows
[
temp
].
uvr
;
time = rows[temp].time;
uvr = rows[temp].UV;
discomfort = rows[temp].discomfort;
heat = rows[temp].heat;
sensibleTem
=
rows
[
temp
].
sensibleTem
;
windSpeed
=
rows
[
temp
].
w
indSpee
d
;
presentTem
=
rows
[
temp
].
presentTem
;
skyState
=
rows
[
temp
].
sky
State
;
rainfall
=
rows
[
temp
].
rain
fall
;
sensibleTem = rows[temp].
SensibleT
;
windSpeed = rows[temp].w
sp
d;
presentTem = rows[temp].
CurrentT
;
skyState = rows[temp].sky;
rainfall = rows[temp].rain;
typhoon = rows[temp].typhoon;
lightning = rows[temp].lightning;
}
})
deathProb
=
uvr
+
discomfort
+
heat
+
sensibleTem
+
windSpeed
+
presentTem
+
skyState
+
rainfall
+
typhoon
+
lightning
;
sql
=
'INSERT INTO kkonzi_test.deathProb (prob) VALUES (?)'
;
var
params
=
deathProb
;
db
.
query
(
sql
,
function
(
err
,
rows
,
fields
){
if
(
err
)
{
console
.
log
(
err
);
}
else
{
console
.
log
(
'Success!'
);
}
alert = rows[temp].alert;
}
})
...
...
Please
register
or
login
to post a comment