I have been doing some tutorials around nodejs. One tutorial mentions a library called "connect-flash" that lets you set "flash data".
I have never heard of this term before could someone please define this? (I found the readme rather unhelpful)
Thanks
Flash memory is a long-life and non-volatile storage chip that is widely used in embedded systems. It can keep stored data and information even when the power is off. It can be electrically erased and reprogrammed. Flash memory was developed from EEPROM (electronically erasable programmable read-only memory).
Flash storage uses memory cells to store data. Cells with previously written data must be erased before new data can be written. Flash storage can also come in several forms, from simple USB sticks to enterprise all-flash arrays.
Common examples of Flash memory include: Multi-Media Card (MMC) - a Flash-based memory card standard used for solid-state storage in smartphones, digital cameras, music players, video camcorders, and personal computers. These cards store digital information such as text, pictures, audio, and video.
Flash storage is a solid-state technology that uses flash memory chips for writing and storing data. Solutions range from USB drives to enterprise-level arrays. Flash storage can achieve very fast response times (microsecond latency), compared to hard drives with moving components.
It's a type of user data that you show once and then destroy. Usually a top alert like "Your action has been successful" or similar.
By its nature it's dynamic, so it's saved in the user session and displayed in the very first rendered page, then discarded.
Taken from the doc page for the connect-flash library which seems fairly self-explanatory:
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 middleware was extracted from Express 2.x, after Express 3.x removed direct support for the flash. connect-flash brings this functionality back to Express 3.x, as well as any other middleware-compatible framework or application. +1 for radical reusability.
...
Flash messages are stored in the session. First, setup sessions as usual by enabling cookieParser and session middleware. Then, use flash middleware provided by connect-flash.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With