如果使用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' });
};






相关文章:

  • 2021-12-16
  • 2021-06-06
  • 2022-12-23
  • 2021-09-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-22
相关资源
相似解决方案