1.0.3 • Published 5 years ago
ejs-flash v1.0.3
ejs-flash
A module for making flash messages using the EJS view engine in Express
Examples
Express Examples
Basic
res.flash('index',
{
type: 'error',
message: 'An error occured!'
}
);
Extra Options
res.flash('index',
{
type: 'error',
message: 'An error occured, here are the details:...',
title: 'An error occured!',
class: 'alert error',
id: '123456789'
}
);
EJS Examples
Basic
<% if (flash) { %>
<% if (flash.type === 'error') { %>
<p class="alert error">Error: <%= flash.message %></p>
<% } %>
<% } %>
Extra Options
<% if (flash) { %>
<% if (flash.type === 'error') { %>
<h1><%= flash.title %></h1>
<p class="<%= flash.class %>">Error: <%= flash.message %></p>
<code>ID: <%= flash.id %></code>
<% } %>
<% } %>