I am trying to use Embedded Javascript renderer for node. I installed it using npm, as given here: https://github.com/visionmedia/ejs
And I have the following code, but
You need to send something to the response. From the connect hello-world
var connect = require('../../lib/connect');
var server = connect.createServer(function(req, res){
var body = 'Hello World';
res.writeHead(200, {
'Content-Type': 'text/plain'
, 'Content-Length': body.length
});
res.end(body);
});
server.listen(3000);
console.log('Connect server listening on port 3000');
So for your app you'll want to replace:
function(req,res) {
ejs.render('hi');
}
With something like:
function(req,res) {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end(ejs.render('hi'));
}
Does that work?