Gathering detailed insights and metrics for @fastify/flash
Gathering detailed insights and metrics for @fastify/flash
Gathering detailed insights and metrics for @fastify/flash
Gathering detailed insights and metrics for @fastify/flash
npm install @fastify/flash
Typescript
Module System
Node Version
NPM Version
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
NOASSERTION License
34 Stars
182 Commits
15 Forks
15 Watchers
3 Branches
27 Contributors
Updated on Jul 01, 2025
Latest Version
6.0.3
Package Id
@fastify/flash@6.0.3
Unpacked Size
9.08 kB
Size
3.68 kB
File Count
7
NPM Version
10.8.2
Node Version
20.18.1
Published on
Jan 10, 2025
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
1
The flash is a special area of the session used for storing messages. Messages are written to the flash and cleared after being displayed to the user. The flash is typically used in combination with redirects, ensuring that the message is available to the next page that is to be rendered.
This plugin is inspired by connect-flash.
npm i @fastify/flash
Flash messages are stored in the session. First, we need to register the session plugin: @fastify/secure-session.
1const fastify = require('fastify')() 2const fastifySession = require('@fastify/secure-session') 3const fastifyFlash = require('@fastify/flash') 4 5fastify.register(fastifySession, { 6 // adapt this to point to the directory where secret-key is located 7 key: fs.readFileSync(path.join(__dirname, 'secret-key')), 8 cookie: { 9 // options from setCookie, see https://github.com/fastify/fastify-cookie 10 } 11}) 12fastify.register(fastifyFlash) 13 14fastify.get('/test', (req, reply) => { 15 req.flash('warning', ['username required', 'password required']) 16 17 const warning = reply.flash('warning') 18 reply.send({ warning }) // {"warning":["username required","password required"]} 19})
@fastify/secure-session
can be replaced by any session plugin as long as it:
Signature
1req.flash(type: string, ...message: string[] | [string[]]): number
It can be called in three different ways:
req.flash('info', 'Welcome back')
req.flash('warning', ['username required', 'password required'])
req.flash('info', 'Hello %s', 'Jared') // will use util.format to format the string
req.flash
returns the number of messages stored with the provided type.
signature
1reply.flash(type?: string): { [k: string]: undefined | string[] } | string[]
It can be called in two different ways:
reply.flash() // returns all messages as object { [k: string]: undefined | string[] }
reply.flash('info') // returns an array of messages that are stored with the provided type
Licensed under MIT.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
GitHub workflow tokens follow principle of least privilege
Details
Reason
0 existing vulnerabilities detected
Reason
security policy file detected
Details
Reason
license file detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 9
Details
Reason
3 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 2
Reason
Found 5/22 approved changesets -- score normalized to 2
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
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