I’m using the EJS template engine with express.js and I want to use the view helpers. I found this on github: https://github.com/tanema/express-helpers, but when I try to use it I get this error:
TypeError: object is not a function
at Object.CALL_NON_FUNCTION (native)
at Object. (/home/node/app/app.js:12:40)
at Module._compile (module.js:402:26)
at Object..js (module.js:408:10)
at Module.load (module.js:334:31)
at Function._load (module.js:293:12)
at Array. (module.js:421:10)
at EventEmitter._tickCallback (node.js:126:26)
whereas this line is line 12 on app.js:
var helpers = require('express-helpers')(app);
and if I make it
var helpers = require('express-helpers');
it does throw the error, but also does not work.
My top of the app.js file is as follows:
var express = require('express');
var app = express.createServer();
app.listen(34573);
// !Requires
var helpers = require('express-helpers')(app);
Ideas?
Thanks in advance!
My bad.
It turns out that I had my links mixed, and the usage I was trying was meant for a forked branch. I cloned the branch, and overwrote the default https://github.com/masahiroh/express-helpers and the code worked as it was supposed to with the correct branch.
Thanks anyway!