Actix Web Flash

Build Status Crates.io dependency status license

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::withredirect("This is the message".toowned(), "/show_flash") }

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