我正在尝试使用 node、express 和 mongodb 将对象呈现为 html。当我尝试下面的代码时
var express=require('express'),
app=express(),
engines = require('consolidate'),
nunjucks = require('nunjucks');
app.set('view engine', 'html');
app.engine('html', engines.nunjucks);
app.set('views', __dirname + '/views');
app.get('/',function(req,res){
res.render('index',{'name':'Hello'});
})
app.use(function(req,res){
res.sendStatus(404);
})
var server = app.listen(3000,function(){
var port=server.address().port;
console.log('Express server listening on port', port);
})
我收到如下回调函数错误
D:\Wiki>node app.js
D:\Wiki\node_modules\express\lib\application.js:174
if ('function' != typeof fn) throw new Error('callback function required');
^
Error: callback function required
at Function.app.engine (D:\Wiki\node_modules\express\lib\application.js:174:
38)
at Object.<anonymous> (D:\Wiki\app.js:7:5)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:968:3
有人可以帮我如何使用 nunjucks 渲染 html 吗?提前致谢