Swagg Swagg -4 years ago 148
Node.js Question

Rendering `html` when using `jade` templating engine, in Express

How do you render an

html
file while keeping the templating engine as
jade
?

app.set('view engine', 'jade');
is where i've set the templating engine as
jade
and I want to do something like

app.get('/world', function(req,res){
res.render('profile.html', );


To render the
html
file.

I'm programming in node.js using express.js.

Note: i've already
require
html
using
var html=require('html');


Edit:

I understand
res.render
need not be used as
html
is already rendered.
res.send(profile.html);
gives error of
profile is undefined

Answer Source

You can render jade files (.jade) but not html files as the result will be the html. What do you mean by rendering the html file?

Replace your res.render('profile.html') by res.sendfile('[path_to_the_file]profile.html')

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download