Actix Web Flash

Actix web flash is an unofficial crate to provide flash messages in servers using Actix web.

Flash messages are typically used to display errors on websites that are rendered server side.

```rust use actixweb::{http, server, App, HttpRequest, HttpResponse, Responder}; use actixweb_flash::{FlashMessage, FlashResponse, FlashMiddleware};

fn showflash(flash: FlashMessage) -> impl Responder { flash.intoinner() }

fn setflash(req: &HttpRequest) -> FlashResponse { FlashResponse::new( Some("This is the message".toowned()), HttpResponse::SeeOther() .header(http::header::LOCATION, "/showflash") .finish(), ) }

fn main() { server::new(|| { App::new() .middleware(FlashMiddleware::default()) .route("/showflash", http::Method::GET, showflash) .resource("/setflash", |r| r.f(setflash)) }).bind("127.0.0.1:8080") .unwrap() .run(); } ```

License

MIT/Apache-2.0