곽태식

success access kk

......@@ -42,7 +42,7 @@ app.use(function(err, req, res, next) {
res.render('error');
});
server.listen(80);
server.listen(8099);
SOCKETIO(server,app);
module.exports = app;
......
module.exporst = {
host : 'localhost',
user : 'root',
password : 'Dltgld55%%',
port : 3306,
database : 'my_db'
};
\ No newline at end of file
const mysql = require('mysql');
const option = require('./db_option');
const connection = mysql.createConnection(option);
var mysql = require('mysql');
var option = require('./db_option');
var connection = mysql.createConnection(option);
connection.connect();
......
......@@ -124,7 +124,7 @@ module.exports = (server, app) => {
console.log("emit");
//db에 저장
sql = "INSERT INTO weatherInfo (time,wind,temperature,rain,prob) VALUES (?,?,?,?,?)";
sql = "INSERT INTO weather_info (time,wind,temperature,rain,prob) VALUES (?,?,?,?,?)";
db.query(sql, [client_send.time, client_send.wind, client_send.temperature, client_send.rain, client_send.death], (err, result) => {
if (err) console.log(err);
})
......
......@@ -23,7 +23,7 @@ router.get('/name/:name/birth/:birth', (req,res) => {
const birth = req.params.birth;
// 이전 10분간 데이터 찾기
sql = "SELECT * FROM weatherInfo WHERE time >= DATE_FORMAT(DATE_ADD(now(), INTERVAL -20 MINUTE), '%Y-%m-%d %H:%i:%s')";
sql = "SELECT * FROM weather_info 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)
{
......