From the course: Building a Website with Node.js and Express.js

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Template engines and Express

Template engines and Express

From the course: Building a Website with Node.js and Express.js

Start my 1-month free trial

Template engines and Express

- When building a dynamic website, there's always some static HTML that should contain some dynamic data. Let's look at an example. Imagine you have some array that contains a list of persons and you want to output this on an HTML page. Maybe you already got the HTML from your designer. So, how can we combine our data with the provided HTML? This is where template engines come into play. They always provide some special syntax to work with dynamic data. Here is an example in pseudocode. Finally, we need something that does the actual work of pausing the template file, combining it with the provided dynamic data, and then rendering it to HTML. This is what the template engine does. On top of that, there is one more reason why you want to use templates. Let's look at the website we are building. There are parts that appear throughout the sites like the hero section, the navigation, or the gallery. Using templates, we can…

Contents