“错误:没有默认引擎指定并没有扩展名被提供”,用特快车把

“错误:没有默认引擎指定并没有扩展名被提供”,用特快车把

var express = require('express');  

var exphbs = require('express-handlebars');

var MailerConnect = require('./nodemailer.js');

var app = express();

app.engine('handlebars', exphbs({

defaultLayout: 'test'

}));

app.set('view engine', 'handlebars');

var file = module.exports = {

Mailer: function(req, res) {

res.render('testtemplate', function(err, data) {

var data = data;

console.log(data);

MailerConnect.sendMail(data);

});

}

}

Error: No default engine was specified and no extension was provided. at new View (C:\Users\manjunathan\node_modules\express\lib\view.js:61:11) at Function.render (C:\Users\manjunathan\node_modules\express\lib\applicatio n.js:570:12) at ServerResponse.render (C:\Users\manjunathan\node_modules\express\lib\resp onse.js:1008:7) at Object.Mailer (C:\Users\manjunathan\app.js:13:7)]

回答:

无法评论,但如此认为这是一个注释。

您的公用文件夹集?

app.set('views', path.join(__dirname, 'views')); 

以上是 “错误:没有默认引擎指定并没有扩展名被提供”,用特快车把 的全部内容, 来源链接: utcz.com/qa/259504.html

回到顶部