你如何渲染一个html
文件,同时保持模板引擎为jade
?
app.set('view engine', 'jade');
是我将模板引擎设置为jade
我想做一些类似的事情
app.get('/world', function(req,res){
res.render('profile.html', );
渲染html
file.
我正在使用express.js 在node.js 中进行编程。
注意:我已经require
html
using var html=require('html');
Edit:
我明白res.render
不需要用作html
已经渲染了。res.send(profile.html);
给出的错误为profile is undefined
您可以渲染 jade 文件 (.jade),但不能渲染 html 文件,因为结果将是 html。渲染html文件是什么意思?
更换你的res.render('profile.html')
by res.sendfile('[path_to_the_file]profile.html')
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)