1.0.3 • Published 5 years ago

ejs-flash v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

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>
  <% } %>
<% } %>
1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago