1
0
mirror of https://github.com/actix/examples synced 2024-12-03 18:22:14 +01:00
examples/middleware/src/main.rs

21 lines
411 B
Rust
Raw Normal View History

2018-07-09 20:18:31 +02:00
extern crate actix;
extern crate actix_web;
use actix_web::{server, App};
mod simple;
fn main() {
let sys = actix::System::new("middleware-example");
let _addr = server::new(|| {
App::new()
.middleware(simple::SayHi)
.resource("/index.html", |r| r.f(|_| "Hello, middleware!"))
}).bind("0.0.0.0:8080")
.unwrap()
.start();
let _ = sys.run();
}