Move /home route to be first and now it works???...must research this.
This commit is contained in:
		
							parent
							
								
									06fcae38ef
								
							
						
					
					
						commit
						dac79d3562
					
				
							
								
								
									
										37
									
								
								server.js
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								server.js
									
									
									
									
									
								
							@ -36,6 +36,21 @@ app.engine('hbs', hbs.express4({
 | 
			
		||||
app.set('view engine', 'hbs');
 | 
			
		||||
app.set('views', __dirname + '/views');
 | 
			
		||||
 | 
			
		||||
// temp testing for static home pages.
 | 
			
		||||
app.get('/home', function(req, res) {
 | 
			
		||||
   // Even when the winston call is the only thing in here...IT NO WORKY!!!
 | 
			
		||||
   // But when I move it to be the first route in the file...IT DOES WORK!!! wtf?
 | 
			
		||||
   winston.info('GET /home');
 | 
			
		||||
   //res.status(404).send('Not found');
 | 
			
		||||
   res.render('home', {}, function(err, html) {
 | 
			
		||||
        if(err !== null) {
 | 
			
		||||
            winston.error(err);
 | 
			
		||||
        } else {
 | 
			
		||||
            res.send(html);
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
app.get('/', function(req, res){
 | 
			
		||||
    winston.info("GET /");
 | 
			
		||||
    pg.connect(conString, function(err, client, done) {
 | 
			
		||||
@ -195,28 +210,6 @@ app.get('/:loc/status', function(req, res) {
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
// temp testing for static home pages.
 | 
			
		||||
app.get('/home', function(req, res) {
 | 
			
		||||
   // Even when the winston call is the only thing in here...IT NO WORKY!!!
 | 
			
		||||
   winston.info('GET /home');
 | 
			
		||||
   // try to sleep here
 | 
			
		||||
    var exec = require('child_process').execSync;
 | 
			
		||||
    var cmd = 'sleep(1)';
 | 
			
		||||
    winston.info(cmd);
 | 
			
		||||
    exec(cmd, function(error, stdout, stderr) {
 | 
			
		||||
        if (error) { winston.error(error); }
 | 
			
		||||
        winston.info(stdout);
 | 
			
		||||
    });
 | 
			
		||||
   //res.status(404).send('Not found');
 | 
			
		||||
   //res.render('home', {}, function(err, html) {
 | 
			
		||||
        //if(err !== null) {
 | 
			
		||||
            //winston.error(err);
 | 
			
		||||
        //} else {
 | 
			
		||||
            //res.send(html);
 | 
			
		||||
        //}
 | 
			
		||||
    //});
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
setInterval(function() {
 | 
			
		||||
    // Check every hour to see if GoodMorning or GoodEvening has gone missing.
 | 
			
		||||
    pg.connect(conString, function(err, client, done) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user