ericf / express-handlebars

A Handlebars view engine for Express which doesn't suck.
BSD 3-Clause "New" or "Revised" License
2.32k stars 382 forks source link

Cannot update layout. #214

Open wisniewski94 opened 6 years ago

wisniewski94 commented 6 years ago

I'm trying to update my layout but it still sends me old version of page. I tried to remove cache, changing ports and browsers and even now when content in files doesn't exist it's still being sent to client. I tried to use app.disable('view cache'); but that also doesn't help.

console.log("success");

var express = require('express');
var app = express();
var handlebars = require('express-handlebars').create({defaultLayout: 'main'});

app.engine('handlebars', handlebars.engine);
app.set('port', process.env.PORT || 3001);
app.set('view engine', 'handlebars');

app.use(express.static(__dirname + '/public'));
app.get('/', function(req, res) {
res.render('home');
});

app.get('/about', function(req, res) {
res.render('about');
});

console.log(__dirname+'/public');
app.use(function(req, res){
res.type('text/plain');
res.status('404');
res.send('404 - not found');
});

app.use(function(err, req, res, next) {
console.log(err.stack);
res.type('text/plain');
res.status('500');
res.send('Server error 500');
});

app.listen(app.get('port'),function() {console.log('listening on http://localhost:' + app.get('port'));});

app.disable('view cache');