设置express ejs模板的后缀名html

如果使用jade或者ejs模板引擎的话 模板文件的格式为ejs或者jade ,有时候需要将后缀名修改为 html格式的。

app.set('view engine','ejs');
 app.engine('.html',require('ejs').__express);或者app.engine('html', require('ejs').renderFile);




同时route中的代码 也要加上后缀比如

exports.index = function(req, res){
res.render('index.html', { title: 'Express' });
};






posted on 2013-11-27 17:22  dubaokun  阅读(1312)  评论(0编辑  收藏  举报

导航

新浪微博 新博客 Github