Reputation: 630
I'm trying to use jade via node, but when I run this code I get the html parsed by jade beetwen 'pre' tags.
var http = require('http');
var jade = require('jade');
http.createServer(function(request, response){
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end(jade.renderFile('index.jade'));
}).listen(8124);
console.log('Server running at http://127.0.0.1:8124/');
How can I make node render raw html without scaping anything?
Upvotes: 0
Views: 491
Reputation: 5932
To render HTML, you need to use 'Content-Type': 'text/html; charset=UTF-8'
. Using text/plain
will render the HTML as plain text (without interpretation) and will make it look as if the HTML was rendered between <pre></pre>
tags.
Upvotes: 1