handlebars: TypeError: exphbs is not a function
Thiago
Posted on March 13, 2024
I was trying to use handlebars as my template engine on nodejs doing this:
const exphbs = require("express-handlebars");
app.engine("hbs", exphbs());
app.set("view engine", "hbs");
app.set("views", "views");
but this gerate an error:
To fix this, I had to change the way I import
const express = require('express');
const { engine } = require('express-handlebars');
const app = express();
app.engine('handlebars', engine());
app.set('view engine', 'handlebars');
app.set("views", "./views");
đź’– đź’Ş đź™… đźš©
Thiago
Posted on March 13, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
githubcopilot AI Innovations at Microsoft Ignite 2024 What You Need to Know (Part 2)
November 29, 2024