I have been cracking my head over this, I am trying to render an EJS file and save the result as an HTML, the saving part seems to be working but I can't get the full hand of how to return the data from the 'template' file.
var fileName = 'public/cv/' + userID + '_default.html';
var stream = fs.createWriteStream(fileName);
function buildHtml(request) {
var sveducations = JSON.parse(SQReducations);
var header = '';
return '<!DOCTYPE html>'
+ '<html><header>' + header + '</header><body>' +
html
+
'</body></html>';
};
stream.once('open', function (fd) {
var html = buildHtml();
stream.end(html);
});
<body>' + html + '</body>
the html variable seems to not be defined. The what do you mean by how to return the data from the 'template' file ? – Pantelleria