diff --git a/server.js b/server.js index db36eb4..b5582a1 100644 --- a/server.js +++ b/server.js @@ -48,9 +48,8 @@ But, for now, order routes like this: - static routes, ordered more specific to less specific - dynamic routes, ordered more specific to less specific ********************************************************************************************************/ -// temp testing for static home page. -app.get('/home', function(req, res) { - winston.info('GET /home'); +app.get('/', function(req, res){ + winston.info("GET /"); res.render('home', {}, function(err, html) { if(err !== null) { winston.error(err); @@ -60,43 +59,6 @@ app.get('/home', function(req, res) { }); }); -app.get('/', function(req, res){ - winston.info("GET /"); - pg.connect(conString, function(err, client, done) { - if(err) { - return winston.error('error fetching client from pool', err); - } - var devIndexQry = - "select status, published_at " + - "from alerts " + - "where status in ('Open', 'Closed') " + - "order by published_at desc " + - "limit 2" - client.query(devIndexQry, function(err, result) { - //call `done()` to release the client back to the pool - done(); - if(err) { - return winston.error('error running query', err); - } - // Loop over elements in rows array, convert ugly UTC times to pretty local times. - result.rows.forEach(function(row){ - row.pubdate = courtsopenUtils.getLocDateFromUTC(row.published_at); - row.pubtime = courtsopenUtils.getLocTimeFromUTC(row.published_at); - if(row.status.toLowerCase().indexOf('closed') > -1){ - row.statusclass = 'closed'; - } else { row.statusclass = 'open'; } - }); - res.render('index', {values: result.rows}, function(err, html) { - if(err !== null) { - winston.error(err); - } else { - res.send(html); - } - }); - }); - }); -}); - app.post('/', function(req, res){ var postEvent = req.body.postEvent; var source = req.body.source; @@ -148,8 +110,6 @@ app.get('/:loc', function(req, res) { if (loc !== 'tt') { res.status(404).send('Not found'); } else { - // This is repeated code from app.get('/') handler. - // TODO, refactor as exported function in courtsopenUtils.js. winston.info("GET /tt"); pg.connect(conString, function(err, client, done) { if(err) { diff --git a/views/home.hbs b/views/home.hbs index 24437e4..0e41acf 100644 --- a/views/home.hbs +++ b/views/home.hbs @@ -6,13 +6,17 @@
At each location, we supply an internet-enabled physical switch to update status pages here at TennisCourtsOpen.com.
-Want to sign on as another TennisCourtsOpen.com location? Email us.
-Here are the currently supported locations: | -
---|
Temple Terrace Recreation Center, clay courts |
At each location, we supply an internet-enabled physical switch to update status pages here at TennisCourtsOpen.com.
+Want to sign on as another TennisCourtsOpen.com location? Email us.
+Here are the currently supported locations: | +
---|
Temple Terrace Recreation Center, clay courts |