I am brand new to node and handlebars as of two days ago so bear with me. I am trying to use custom handlebars helpers but am not entirely sure where to put it.
I keep g
Just came across the same problem. Thanks to R.A.Lucas and Drkawashima, the answers above are correct, but here's a slightly shorter option.
var express = require('express');
var handlebars = require('express-handlebars');
var app = express();
app.engine('handlebars', handlebars({
helpers: {
sayHello: function () { return "Hello"; },
getStringifiedJson: function (value) {
return JSON.stringify(value);
}
},
partialsDir: ['views/partials/'],
defaultLayout: 'main'
}));
app.set('view engine', 'handlebars');