我有一个简单的列表视图,其中我(尝试)使用mutatche呈现包含5个结果的列表的输出。
function(head, req) {
var row,
mustache = require("vendor/couchapp/lib/mustache.js"),
template = "<li>{{project}} {{version}} {{description}}</li>";
while(row = getRow()) {
send(mustache.to_html(template,row));
}
}
这会导致超时:
[error] [<0.22977.0>] OS Process Error <0.22858.0> :: {os_process_error,"OS process timed out."}
当我尝试
function(head, req) {
var row,
template = "<li>{{project}} {{version}} {{description}}</li>";
while(row = getRow()) {
send("Hello");
}
}
这很好地打印了5个你好。
我把范围缩小到了加载模板代码的require语句。
有人能告诉我蒂莫特是从哪里来的吗?
------已解决-------
这个
require
调用不喜欢要引用的代码的文件名的“.js”文件扩展名。
将其更改为:
function(head, req) {
var row,
mustache = require("vendor/couchapp/lib/mustache"),
template = "<li>{{project}} {{version}} {{description}}</li>";
while(row = getRow()) {
send(mustache.to_html(template,row));
}
}
解决了问题。