【发布时间】:2015-07-01 20:28:56
【问题描述】:
我是 JS 新手。我找到了similar question,但在其他意义上。我的问题是:模板 Jade on Express 与发送行 html 作为响应有什么区别或优势。我的意思是:为什么我会在 Express 上使用模板 Jade:
app.set('view engine', 'jade');
app.get('/', function (request, response) {
response.render('index');});
如果我可以直接发送 html 文件作为响应:
app.get('/', function (request, response) {
response.set('Content-Type', 'text/html');
response.sendFile('/index.html');});
我为什么要花时间处理渲染和发送 Jade 文件而不是直接发送 html 文件。
谢谢!
【问题讨论】:
标签: html node.js templates express pug