From eea9567b9b99f80ea1c95daa04c7aae204dd0e2a Mon Sep 17 00:00:00 2001 From: jkaplon Date: Fri, 3 Jul 2015 21:38:40 -0400 Subject: [PATCH] Add js reload timer to template; add timestamp to console GET message; temp disable email --- server.js | 22 +++++++++++++--------- views/home.hbs | 8 ++++++++ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/server.js b/server.js index 2192e4c..8c72541 100644 --- a/server.js +++ b/server.js @@ -57,9 +57,10 @@ app.set('views', __dirname + '/views'); app.get('/', function(req, res){ //res.sendFile("/usr/src/app/index.html"); //fs.createReadStream('./log.log').pipe(res); - console.log("got a GET request..."); + var d = new Date(); + console.log("GET request at, " + JSON.stringify(d, 4)); db.all("SELECT coreId, published_at FROM Alerts ORDER BY published_at DESC LIMIT 30;", function(err, rows){ - console.log(rows); + //console.log(rows); res.render('home', {alerts: rows}, function(err, html) { res.send(html); }); @@ -80,13 +81,16 @@ app.post('/', function(req, res){ JSON.stringify(req.body.published_at, null, 4) ); stmt.finalize(); - transporter.sendMail(mailOptions, function(error, info){ - if(error){ - console.log(error); - }else{ - console.log('Message sent: ' + info.response); - } - }); + + // Emails were working...don't need to send on every POST anymore. + //transporter.sendMail(mailOptions, function(error, info){ + //if(error){ + //console.log(error); + //}else{ + //console.log('Message sent: ' + info.response); + //} + //}); + //res.send(JSON.stringify(req.body, null, 4)); }); diff --git a/views/home.hbs b/views/home.hbs index dd833b9..ad09dee 100644 --- a/views/home.hbs +++ b/views/home.hbs @@ -10,5 +10,13 @@
  • {{this.coreId}}: {{this.published_at}}
  • {{/each}} + +