EJS Example
h
Vandesm14 (1695)

If you guys needed an example of how EJS works and how awesome it is, here you go: https://repl.it/@Vandesm14/EJS-Example

EJS is a server-side rendering library which allows the server to insert data into pages before it sends it off to he client. It works by using special tags documented in the EJS docs. This engine allows you to execute javascript and pass values to the file.

Value insertion

<p>Welcome, <%= user.name %>
let user = { name: "John", points: "1362" };
res.render('public/welcome.ejs', { user });

Executing JS

<% for (let i in posts) { %>
<p class="post"><%= posts[i].title %></p>
<% } %>
let posts = [ { title: "updates v1" }, { title: "updates v2" } ];
res.render('public/welcome.ejs', { posts });

EJS Docs: https://ejs.co/
Express Docs: https://expressjs.com/en/api.html

You are viewing a single comment. View All
Vandesm14 (1695)

@MatthewDoan1 Like the title of the page or the route (/home)?