в app.js:
if(data.type == 'error')
{
res.render('login', {alert: true, alertTitle: "Oops!", alertMessage: "Something went wrong!"})
}
в login.ejs
<script>
$(document).ready(function () {
if (alert === true) {
var alert = <%= alert %>
var alertTitle = <%= alertTitle %>
var alertMessage = <%= alertMessage %>
swal(alertTitle, alertMessage, "success");
}
})
</script>