Have you any Idea what's wrong here? When I run a view file in a single page Its run fine but when I add external layout in this template its generate an error. What do you think what is the problem in this code?
const expressHbs = require('express-handlebars');
app.engine(
expressHbs({
extname: "hbs",
defaultLayout: "main-layouts",
layoutsDir: "views/layouts"
})
);
app.set('view engine', 'hbs');
Try this, hope your issue would be solved:
app.engine(
"hbs",
expressHbs({
extname: "hbs",
defaultLayout: "main-layouts",
layoutsDir: "views/layouts"
})
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With