I'm trying to render an EJS template from file but I'm getting an error this.templateText.replace is not a function
const http = require('http');
const fs = require('fs');
const ejs = require('ejs');
const server = http.createServer(function(req, res){
fs.readFile('index.ejs', function(err, data) {
if (err) {
res.end("Error");
}
res.end(ejs.render(data, { title: "Hello" }));
});
});
server.listen(4000);