Showing
3 changed files
with
23 additions
and
2 deletions
This diff is collapsed. Click to expand it.
... | @@ -12,9 +12,10 @@ | ... | @@ -12,9 +12,10 @@ |
12 | "debug": "~2.6.9", | 12 | "debug": "~2.6.9", |
13 | "ejs": "~2.5.7", | 13 | "ejs": "~2.5.7", |
14 | "express": "~4.16.0", | 14 | "express": "~4.16.0", |
15 | + "helmet": "^3.13.0", | ||
15 | "http-errors": "~1.6.2", | 16 | "http-errors": "~1.6.2", |
16 | "morgan": "~1.9.0", | 17 | "morgan": "~1.9.0", |
17 | - "helmet": "^3.13.0", | 18 | + "mysql": "^2.16.0", |
18 | "socket.io": "^2.1.1" | 19 | "socket.io": "^2.1.1" |
19 | } | 20 | } |
20 | } | 21 | } | ... | ... |
1 | var express = require('express'); | 1 | var express = require('express'); |
2 | var router = express.Router(); | 2 | var router = express.Router(); |
3 | +var mysql = require('mysql'); | ||
4 | + | ||
5 | +var connection = mysql.createConnection({ | ||
6 | + host : 'ryulth.com', | ||
7 | + user : 'kkonzi', | ||
8 | + password : 'kkonzi1234', | ||
9 | + database : 'kkonzi_test' | ||
10 | +}); | ||
3 | 11 | ||
4 | /* GET home page. */ | 12 | /* GET home page. */ |
5 | router.get('/', function(req, res, next) { | 13 | router.get('/', function(req, res, next) { |
6 | - res.render('index', { title: 'Express' }); | 14 | + // mysql 세션 연결 |
15 | + connection.connect(); | ||
16 | + // connection.query('SELECT * FROM '); | ||
17 | + | ||
18 | + // 자외선지수, 불쾌지수, 열지수, 체감 온도, 바람속도, 현재기온, 하늘 상태, 강우량, 태풍, 낙뢰 | ||
19 | + var uvr, discomfort, heat, sensibleTem, windSpeed, presentTem, skyState, rainfall, typhoon, lightning; | ||
20 | + // 사망 확률 | ||
21 | + var deathProb; | ||
22 | + | ||
23 | + deathProb = uvr + discomfort + heat + sensibleTem + windSpeed + presentTem + skyState + rainfall + typhoon + lightning; | ||
24 | + res.render('index', {title: 'Express'}); | ||
25 | + | ||
26 | + connecttion.end(); | ||
7 | }); | 27 | }); |
8 | 28 | ||
9 | module.exports = router; | 29 | module.exports = router; | ... | ... |
-
Please register or login to post a comment