Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clout-flash

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clout-flash

Flash message middleware module for Clout-JS

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

clout-flash

Install

In the directory of your clout-js application, do the following;

  1. Install this package
npm install clout-flash
  1. Add this module to package.json
{
    ...
    "modules": ["clout-flash"]
    ...
}

Usage

After the installation of this module, all APIs and Controllers will have access to a req.flash() function for flash messages.

req.flash(); // returns and unsets data [@type: Object]
req.flash('info'); // returns and unsets data for key `info` [@type: Array]
req.flash('info', 'This is a test message'); // sets data for key `info`
  • Setting a flash value
{
    path: '/flash',
    method: 'GET',
    description: 'Set a flash message',
    fn: function (req, res, next) {
        req.flash();
        req.flash('info', 'This is a test message');
        // supports arbitrary formatting using `util.format()`
        req.flash('error', 'Error: %s', 'Your error message');
        res.redirect('/');
    }
}
  • Getting a flash value
{
    path: '/:type',
    method: 'GET',
    description: 'Get a flash message for `type`',
    fn: function (req, res, next) {
        var infoMsg = req.flash(req.params.type);
        res.ok(infoMsg);
    }
}

Keywords

FAQs

Package last updated on 23 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc