-What is Templating
-Setting the Views Directory
-Conditionals in EJS
-Loops in EJS
What is Templating
Templating allows us to define a preset "pattern" for a webpage, that we can dynamically modify.
It is possible to define a single "search" template that displays all the results for a given search term. We don't know what the term is or how many results there are ahead of time. The webpage is created on the fly.
EJS is embedded JavaScript templating engine that is used with node JS.
<%= EJS %>
{% extends "base.html" %}
{% block header %}
<h1>{{ title }}</h1>
{% endblock %}
{% block content %}
<ul>
{% for name, item in items %}
<li>{{ name }}: {{ item }}</li>
{% endfor %}
</ul>
{% endblock %}
EJS Interpolation Syntax
These are taken from the website.
Top comments (0)