fetchNoticeList.js 497 Bytes
const mysql = require("mysql");


var noticeList = async function(req,res){
  var result = [];

  var connection = mysql.createConnection({
    host: "34.64.183.182",
    user: 'root',
    password: '',
    database: 'KhuNotice'
  });
  connection.connect();

  connection.query('select title,link,date_format(date,"%Y-%m-%d") as date,site from noticeList order by date desc',function(err,rows){
    if(err){
        console.log(err);
    }
    res.send(rows);
  })
}

module.exports = noticeList;