Answer the question
In order to leave comments, you need to log in
No replace method in nodeJS?
has no method 'replace'
How to fix the error?
Answer the question
In order to leave comments, you need to log in
toString() - needed. data is an object, much to my surprise.
fs.readFile(pathToFile, function(err, data) {
var s = data.toString().replace('{{ name }}', 'antonowano');
res.end(s);
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question