Ubuntu

add TRUNCATE DB

......@@ -7,6 +7,15 @@ var db = require('../lib/db');
router.post('/starting' , (req,res) => {
res.redirect(`/name/${req.body.name}/birth/${req.body.birth}/city/${req.body.city}/county/${req.body.county}/village/${req.body.village}`);
})
sql1 = "TRUNCATE weatherInfo";
db.query(sql1, function(err, rows, fields){
if(err)
{
console.log(err);
}
});
router.get('/name/:name/birth/:birth/city/:city/county/:county/village/:village', (req,res) => {
// 렌더링 변수
......@@ -25,7 +34,7 @@ router.get('/name/:name/birth/:birth/city/:city/county/:county/village/:village'
const county = req.params.county;
const village = req.params.village;
// 이전 10분간 데이터 찾기
// 이전 20분간 데이터 찾기
sql = "SELECT * FROM weatherInfo WHERE time >= DATE_FORMAT(DATE_ADD(now(), INTERVAL -20 MINUTE), '%Y-%m-%d %H:%i:%s')";
db.query(sql, function(err, rows, fields){
if(err)
......