Reputation: 45
I installed express-handlebars and i tried this
const express = require("express");
const exphbs = require('express-handlebars');
const app = express();
app.engine('.hbs', engine({defaultLayout: 'main', extname: '.hbs'}));
app.set('view engine', '.hbs');
and I get ReferenceError: engine is not defined
Upvotes: 2
Views: 222
Reputation: 45
I changed from
app.engine('.hbs', engine({defaultLayout: 'main', extname: '.hbs'}));
to
app.engine('.hbs', exphbs.engine({defaultLayout: 'main', extname: '.hbs'}));
and it worked
Upvotes: 2