Hi I am having an issue with my EJS error message. Each time the error is passed through, the error message is supposed to be brought into the page but never does. No errors or anything. I debugged a bit and figured out that the res.render wasn't working.
EJS:
<% if(typeof error != "undefined") { %>
<%= console.log(error) %>
<div class="py-8 px-6">
<div class="p-6 border-l-4 border-orange-600 bg-orange-500 rounded-r-lg">
<div class="flex items-center">
<span class="inline-block mr-2">
<svg width="24" height="20" viewbox="0 0 24 20" fill="none" xmlns="http://www.w3.org/2000/svg" data-config-id="auto-svg-1-10"></svg>
</span>
<h3 class="text-white font-medium" data-config-id="header"><%= error %></h3>
<button class="ml-auto">
<svg class="text-orange-800" width="12" height="12" viewbox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" data-config-id="auto-svg-2-10"></svg>
</button>
</div>
</div>
</div>
<% } %>
My API:
if (plainPassword.length < 6) {
error = "Password must be 6 or more characters";
return res.render("signup", { error, username, plainPassword, plainEmail })
}