I'm trying to load template from file system using node.js and can't find the way. So far I have:
exports.index = function(req, res){
var compiled = dust.compile("Hello {name}!", "intro");
dust.loadSource(compiled);
dust.render("intro", {name: "Fred"}, function(err, out) {
res.write(out);
res.close();
});
};
Is there is a way to replace: "Hello {name}!" with file name? Should it be HTML or JS file? Also if that's not really great way on rendering templates let me know, I'm new to Node.js trying to pick up best practices.