小编one*_*r4u的帖子

使用node.js的服务器端mustache.js示例

我使用的是寻找一个例子MustachejsNodejs

这是我的例子,但它不起作用.Mustache未定义.我正在使用主分支中的Mustachejs.

var sys = require('sys');
var m = require("./mustache");

var view = {
  title: "Joe",
  calc: function() {
    return 2 + 4;
  }
};    
var template = "{{title}} spends {{calc}}";    
var html = Mustache().to_html(template, view);

sys.puts(html);
Run Code Online (Sandbox Code Playgroud)

serverside-javascript node.js

28
推荐指数
3
解决办法
2万
查看次数

标签 统计

node.js ×1

serverside-javascript ×1