Ubuntu

add TRUNCATE DB

...@@ -7,6 +7,15 @@ var db = require('../lib/db'); ...@@ -7,6 +7,15 @@ var db = require('../lib/db');
7 router.post('/starting' , (req,res) => { 7 router.post('/starting' , (req,res) => {
8 res.redirect(`/name/${req.body.name}/birth/${req.body.birth}/city/${req.body.city}/county/${req.body.county}/village/${req.body.village}`); 8 res.redirect(`/name/${req.body.name}/birth/${req.body.birth}/city/${req.body.city}/county/${req.body.county}/village/${req.body.village}`);
9 }) 9 })
10 +
11 +sql1 = "TRUNCATE weatherInfo";
12 +db.query(sql1, function(err, rows, fields){
13 +if(err)
14 +{
15 + console.log(err);
16 +}
17 +});
18 +
10 router.get('/name/:name/birth/:birth/city/:city/county/:county/village/:village', (req,res) => { 19 router.get('/name/:name/birth/:birth/city/:city/county/:county/village/:village', (req,res) => {
11 20
12 // 렌더링 변수 21 // 렌더링 변수
...@@ -25,7 +34,7 @@ router.get('/name/:name/birth/:birth/city/:city/county/:county/village/:village' ...@@ -25,7 +34,7 @@ router.get('/name/:name/birth/:birth/city/:city/county/:county/village/:village'
25 const county = req.params.county; 34 const county = req.params.county;
26 const village = req.params.village; 35 const village = req.params.village;
27 36
28 - // 이전 10분간 데이터 찾기 37 + // 이전 20분간 데이터 찾기
29 sql = "SELECT * FROM weatherInfo WHERE time >= DATE_FORMAT(DATE_ADD(now(), INTERVAL -20 MINUTE), '%Y-%m-%d %H:%i:%s')"; 38 sql = "SELECT * FROM weatherInfo WHERE time >= DATE_FORMAT(DATE_ADD(now(), INTERVAL -20 MINUTE), '%Y-%m-%d %H:%i:%s')";
30 db.query(sql, function(err, rows, fields){ 39 db.query(sql, function(err, rows, fields){
31 if(err) 40 if(err)
......