Javascript Templating Language and Engine— Mustache.js with Node and Express

Javascript Templating


As the name suggests, it was named mustache because the syntax resembles a Mustache. E.g. {{ placeholder }}
Mustache.render(“Hello, {{name}}”, { name: “Sherlynn” });
// returns: Hello, Sherlynn
Source: The Ultimate Mustache Tutorial


$ yarn add mustache-express
$ npm install mustache --save
Configure Mustache for use in your node-express application
Create a views folder + html view files
A simple hello.html file with “Hello {{name}}” mustache usage
res.render('hello', {"name": "Sherlynn"})
var nameObject = {"name": "Sherlynn"}res.render('hello', nameObject)
Hello {{name}}

Software Developer at @thoughtworks | Marathon Runner | Ex-Pharmacist Writing on Coding, Technology and Running

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store