Understanding template engines
In Chapter 9, we learned the difference between single-page applications (SPAs) and server-side rendering.
Express provides a way to render HTML pages using template engines. This is the key feature to build server-side rendered applications with Express.
Choosing a template engine
The first thing that we must do is to choose a template engine. There are many options available. The most popular option historically was Jade (https://www.npmjs.com/package/jade), but it was renamed to Pug (https://www.npmjs.com/package/pug). You can find many tutorials and examples by searching using both names.
I personally prefer Embedded JavaScript templating (ejs) (https://www.npmjs.com/package/ejs) for its simplicity and because it is well documented. Over time, you will get more familiar with the template engines and will be able to choose the one that better fits your needs.
Rendering a template
So, going back to our hello world example, let’...