How to use mustache

Comprehensive mustache code examples:

How to use mustache.clearCache:

17
18
19
20
21
22
23
24
25
26
});
app.listen(8000);
// Put a friendly message on the terminal
console.log("Server running at http://127.0.0.1:8000/");
// include this in the server logic:
// mu.clearCache();
        function getGames(ai, date){
                var games = nbaJson[ai];
                var name = nbaJson[ai]["Date"];
                if ( name !== "" ){

How to use mustache.Writer:

How to use mustache.parse:

234
235
236
237
238
239
240
241
242
243
server.views({
    engines: {
        html: {
            compile: (template) => {

                Mustache.parse(template);

                return (context) => {

                    return Mustache.render(template, context);

How to use mustache.to_html:

138
139
140
141
142
143
144
145
146
147
            htmlTemp = htmlTemp.concat(template.encabezado_template, (htmlDataTemplateFile || ''), template.pie_template);                            
            params.nombre_empresa = template.nombre_empresa;
            params.anexo_pie_correo = template.anexo_pie_correo;
            params.logotipo = template.logotipo;
            params.anexo_recibo_pago = (templateName == TEMPLATES.TEMPLATE_RECIBO_PAGO) ? (template.anexo_recibo_pago || '') : '';
            html = mustache.to_html(htmlTemp, params);                        
    }
    return html;
} catch (e) {
    console.log("Error al obtener el template de la BD "+e);

How to use mustache.render:

35
36
37
38
39
40
41
42
43
44
45
        let clientUrl = '{{{clientUrl}}}'.replace('{current_host}', document.location.hostname);
        loadClient(clientUrl);
      })();
    </script>
  `;
  return Mustache.render(scriptTemplate, context);
}


/**
 * Read tags in test pages specifying custom headers to serve the content with.