I am trying to pass a function in express-handlebar, but it is not working. I am using app.js as server file and index.handlebars as handlebar file.
app.js
const express=require('express');
const app=express();
const csc=require('countrycitystatejson');
const exphbs=require('express-handlebars');
app.engine('handlebars', exphbs());
app.set('view engine', 'handlebars');
// console.log(csc.getAll());
function hello(){
console.log('hello');
}
app.get('/', function (req, res) {
res.render('index',{
hello:hello
});
});
app.listen(3000);
index.handlebars
<button onclick="hello()">click</button>