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.

Getting to know the EJS template engine

Getting to know the EJS template engine

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

Start my 1-month free trial

Getting to know the EJS template engine

- [Instructor] I've already opened the website for the ejs template engine that we will use in this course. The website contains the complete documentation which fits neatly on one page. It also lists the features and benefits. Most importantly ejs lets you use regular JavaScript as template language as you see here. So you don't have to learn any new syntax. The only thing that might look unfamiliar to you are the template text. These are the brackets with the percent sign. They instruct ejs to parse what's in there and there are different types. Let's look at them. The simple bracket with the percent sign is used for control flow like conditions or loop statements that don't produce any output. Add an equal sign and it will output the variable inside those tags and escape all html in it. If you use a minus sign the content will be un-escaped. This is when you want to render html that is inside the variable. There are…

Contents