I have data in a text file that contains HTML with template literals like this
<html>
<head></head>
<body>
<p>`${abc}`</p>
</body>
</html>
I have data from the server abc.. I want node to read this data from the .txt file , replace template literals with the data and then append it to another .html file.. This is what I tried
var abc = "Hi there"
var dat = fs.readFileSync('home.txt', 'utf8');
fs.writeFile('index.html', dat, (err) => {
if (err) throw err;
console.log('The file has been saved!');
});
Where am i going wrong?