Flash messages between requests for your Rill application.
A flashed message will persist through multiple requests until it is read. After a flashed message has been read it will be deleted.
npm install @rill/flash
const app =// A session is required to use flash messages.app// Setup the flash middleware.app// Use it!app
ctx.flash(key, value) - Sets a value to be flashed.
ctx.flash(key) - Retrieves a flashed value. (Marks a key as expired and removes it after the request)
Server Side rendering
To help with browser bootstrapping (when using server side rendering) @rill/flash will return the most recent expired flash message on the first request when running in the browser.
This means that if the server renders a page with one flash message, then the browser tries to display that same message when it bootstraps on page load, both the server and the browser will have the same message.
npm testto run tests.
Please feel free to create a PR!