# wisp_flash
Middleware to add flash messages in Wisp
[](https://hex.pm/packages/wisp_flash)
[](https://hexdocs.pm/wisp_flash/)
## Setting the flash message
In your handler:
```gleam
wisp.redirect("/home")
|> wisp_flash.set_flash(request, "success", "Document Saved")
```
## Retrieving the flash message
In your router:
```gleam
use kind, message <- wisp_flash.get_flash(request)
let ctx = Context(..ctx, flash_kind: kind, flash_message: message)
```
In your view:
```gleam
fn alert(ctx: Context) {
  case ctx.flash_message {
    Some(flash_message) -> {
      let kind = ctx.flash_kind |> option.unwrap("notice")
      ...
    }
    None -> div([], [])
  }
}
```