Gathering detailed insights and metrics for connect-flash-light
Gathering detailed insights and metrics for connect-flash-light
Gathering detailed insights and metrics for connect-flash-light
Gathering detailed insights and metrics for connect-flash-light
npm install connect-flash-light
Typescript
Module System
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
3 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Apr 05, 2022
Latest Version
1.0.0
Package Id
connect-flash-light@1.0.0
Size
2.07 kB
NPM Version
2.0.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
No dependencies detected.
This is a dead simple approach to flashing data, connect-middleware style. It is completely unopinionated and highly-versatile. If you've got something you would like to live until the next request, this should do the trick.
$ npm install connect-flash-light
connect-flash-light
uses the session to store flash messages. So first, you will need to include the session
middleware, which in turn requires the cookieParser
middleware.
1var express = require('express'); 2var cookieParser = require('cookie-parser'); 3var session = require('express-session'); 4var flash = require('connect-flash-light'); 5 6var app = express(); 7 8app.use(express.cookieParser()); 9app.use(express.session()); 10app.use(flash());
You can now use the req.flash()
function to flash whatever you would like. To set messages, use the format req.flash(key, value)
. The value can be an valid JavaScript value. To retrieve a message, use the format req.flash(key)
.
1app.get('/flash', function(req, res) { 2 req.flash('msg', 'Your message was flashed!'); 3 res.redirect('/'); 4}); 5 6app.get('/', function(req, res) { 7 res.render('index', { messages: req.flash('msg') }); 8});
1app.post('/form', function(req, res) { 2 // Pass the user input back 3 req.flash('input', req.body); 4 // Namespace messages, instead of just a simple string 5 req.flash('msgs', { 6 forms: { 7 errors: { 8 'There was a form error!' 9 } 10 } 11 }); 12 res.redirect('/form'); 13}); 14 15app.get('/form', function(req, res) { 16 var input = req.flash('input'); 17 var msgs = req.flash('msgs'); 18 res.render('form', { 19 input: input, 20 messages: msgs 21 }); 22});
Copyright 2014 Elliot Fleming <http://elliotfleming.com>
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/3 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More