Leverage Template Engines With ExpressJS and Mustache
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.
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
- Software engineers that want to deep dive into the ExpressJS template engine system
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:
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.