I am following the basic layout of the application you get from Express Generator and trying to configure it for Handlebars.
Excerpt:
var exphbs = require('express-handlebars'); var app = express(); // view engine setup app.set('views', path.join(__dirname, 'views/')); app.engine('handlebars', exphbs({defaultLayout: 'main'})); app.set('view engine', 'handlebars');
Everything is fine until I try to change the extension for Handlebars to .hbs as follows:
app.engine('handlebars', exphbs({defaultLayout: 'main', extname: '.hbs'}));
(and of course rename files).
This leads to:
Error: Could not view "error" in the submissions directory
I looked at function ExpressHandlebars(config) in the source express-handlebars.js and tried to set extname correctly.
What am I doing wrong?
source share