Skip to content

Revving Up View Engines

When we’re doing any server-side generation of HTML, we could build up fragments with brutish string concatenation. But that’s like duct-taping a bumper onto a Ferrari. It works, but it’s ugly, dangerous, and prone to error.

Instead, we use a templating engine. This handles the string interpolation for us, allowing us to “skin” our data with high-performance HTML bodies.

There are many options on the market, each with its own tuning specs:

But for our fleet, we’ll be working primarily with the venerable EJS (Embedded JavaScript). Why? Because it’s classic, reliable, and handles like a dream (although the syntax is a bit ugly and dated).

A translucent '69 muscle car revealing a glowing digital engine core, symbolizing the power of EJS templating.

Fig 1: The EJS Engine—high octane data injection.

EJS syntax is likely going to mess with our code formatting extensions.

There is a specific extension that helps VSCode understand the <% %> syntax so it stops screaming at you.

Install it, and your editor will stop flagging valid EJS tags as errors.


EJS Docs From the Source


⏭ Setting Up Shop

Let’s get EJS installed and set up in our express body shop.