DEV Community

Cover image for Day 23 – Template Engines - Learning Node JS In 30 Days [Mini series]
Muhammad Ali (Nerdjfpb)
Muhammad Ali (Nerdjfpb)

Posted on • Originally published at blog.nerdjfpb.com

Day 23 – Template Engines - Learning Node JS In 30 Days [Mini series]

A template engine enables you to use static template files in your application. At runtime, the template engine replaces variables in a template file with actual values, and transforms the template into an HTML file sent to the client. This approach makes it easier to design an HTML page.

Some popular template engines that work with Express are Pug, Mustache, and EJS. The Express application generator uses Jade as its default, but it also supports several others. (From express official Document)

There are many different templating engines

EJS
Mustache
Handlebars
Underscore
Pug
Marko
We can use any of them to do the frontend while making the api.

I’m going to use EJS to show you how to do this.

Start with the official page – https://ejs.co/

Alt Text

You can check the features of it

Alt Text

Installing it is super easy

Alt Text

So finally our package.json

Alt Text

Want to know more about templating engine ?

You can see the graphical version here

Originally it published on nerdjfpbblog. You can connect with me in twitter or linkedin !

You can read the old posts from this series (below)

Latest comments (0)