数据不使用句柄和expressnjs呈现

嗨,我正在使用express.js和句柄进行应用程序。 当用户在浏览器中inputhttp:// localhost:3000 / id / 2时 ,我使用get方法获取员工的数据。 由于id是2,所以它应该获取数据并使用句柄进行渲染。 我的方法得到工作正常否则,但一旦我用它来渲染它不工作。 虽然我已经做了类似的渲染其他方法,他们工作正常。我检查了标题,它返回304状态码错误。 如何解决它。

//My express get method: app.get('/id/:id1', function(req, res) { res.render('employee', {idData: employees.lookupById(req.params.id1) }); }); 

//employees.lookupByID()方法,我通过require-Mod在主文件中使用

  var _ = require('underscore'); var data = [ {id:1, firstName:'John',lastName:'Smith'}, {id:2, firstName:'Jane',lastName:'Smith'} ]; module.exports.lookupById = function (pid) { if( _.where(data, {id:pid})) { return _.where(data, {id:pid}) } else{ return 0; } }; // My rendering view of employee.handlebars <hr/> <ul> {{#each idData}} <li>{{this.id}}</li> <li>{{this.firstName}}</li> <li>{{this.lastName}}</li> {{/each}} </ul> <b>Thanks</b> 

/ /只在这里感谢得到呈现在我的HTML页面和arrays数据不会返回

那么我该怎么办呢。

 res.render(view [, locals] [, callback]) 

呈现视图并将呈现的HTMLstring发送到客户端。 可选参数:

 // if a callback is specified, the rendered HTML string has to be sent explicitly res.render('index', function(err, html) { res.send(html); }); 

你能更好地解释你正在努力完成什么吗? 谢谢