hands-on lab

Leverage Template Engines With ExpressJS and Mustache

Up to 45m
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.


If you are building a web app using ExpressJS as your only technology stack, you should also need to create a frontend part. Because of this, you need to define HTML pages that will be rendered by your server. Most of the times, you want your pages to be dynamic, so as to be dynamically generated by your server.

ExpressJS has a built-in part to handle template engines. A template engine is an engine that compiles and inserts values into templates (such as HTML templates) you want to render to your users. There are different ExpressJS supported template engines. The most common are Pug, EJS, and Mustache.

In this lab, you will understand the core concept to integrate and use template engines in ExpressJS, and you will then define a simple template that will be populated and rendered by your ExpressJS application using Mustache.

Learning Objectives

Upon completion of this beginner level lab, you will be able to:

  • Understand the principles of template engines in ExpressJS
  • Integrate and use a template engine to render templates to the users

Intended Audience

  • Software engineers that want to deep dive into the ExpressJS template engine system
  • JavaScript developers that want to use ExpressJS both for the frontend and the backend part


To get the most out of this lab, you should have basic knowledge of the ExpressJS framework. To achieve this, we suggest taking the following lab and courses:

About the author

Learning paths

Stefano studies Computer Science and is passionate about technology. He loves working with Cloud services and learning all the best practices for them. Google Cloud Platform and Amazon Web Services are the cloud providers he prefers. He is a Google Cloud Certified Associate Cloud Engineer. Node.js is the programming language he always uses to code. When he's not involved in studying or working, Stefano loves riding his motorbike and exploring new places.

Covered topics

Lab steps

Understanding the ExpressJS Template Engine Principles
Connecting to the NodeJS Web IDE
Integrating Mustache as the ExpressJS Template Engine