express - require an external module in jade in a node.js webserver -
i need require util module in jade template checking.
can that? tried following in jade template sits in $root/views/jade/sample.jade
var utils = require('../../app/server/modules/queries.js')
for module sits in
$root/app/server/modules/queries.js
but not work.
can want????
you can register helpers within express.
in request handler.
var utils = require('../../app/server/modules/queries.js') function(req, res) { res.render("sample", { locals: { title: "welcome derpco", someutilfunction: utils.someutilfunction } }); };
also can register helpers globally using app.locals.helpername = ...
Comments
Post a Comment