ejs-flash

1.0.3 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i ejs-flash

Weekly Downloads

5

Version

1.0.3

License

ISC

Unpacked Size

2.28 kB

Total Files

3

Last publish

Collaborators

  • kieiswillsmith