Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 667
Swagg Avatar asked Aug 22 '13 13:08

Swagg


1 Answers

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')

like image 197
Sebastien C. Avatar answered Oct 18 '22 23:10

Sebastien C.