In a php file I can do:
Is there a way to do this in node, if yes what\'
Use a template engine. From terminal
npm install ejs
In code:
var ejs = require('ejs'); var options = { locals: { foo: function() { return "bar"; } } }; var template = "<%= foo() %>"; console.log(ejs.render(template, options));
<%= foo() %>