Embedded JavaScript

Add Package: ejs
Set View Engine:
app.set(`view engine`, `ejs`)
Move HTML File: Add a new folder called views, and move your HTML file to that folder.
Rename HTML File: Rename your HTML file to end in .ejs instead of .html.
Render HTML File: Replace response.sendFile with response.render:
response.render(`index`) // if your HTML file is called index.ejs
Render Data: Render HTML with data:
let data = {
  yourKey: yourValue
}

response.render(`index`, data)
Embed Data: In your HTML, embed the data:
<%= yourKey %>
Embed JavaScript: In your HTML, embed JavaScript:
<% if (someCondition) { %>
  some HTML
<% } %>
Include HTML: In your HTML, include another HTML file:
<%- include(`another-file.ejs`) %>