express-handlebars
express-handlebars copied to clipboard
Cannot update layout.
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');