mirror of
https://github.com/actix/examples
synced 2025-06-28 09:50:36 +02:00
update more examples and rustfmt
This commit is contained in:
@ -49,16 +49,19 @@ fn main() {
|
||||
// register simple handler, handle all methods
|
||||
.resource("/index.html", |r| r.f(index))
|
||||
// with path parameters
|
||||
.resource("/", |r| r.method(http::Method::GET).f(|_| {
|
||||
HttpResponse::Found()
|
||||
.header("LOCATION", "/index.html")
|
||||
.finish()
|
||||
}))
|
||||
.resource("/", |r| {
|
||||
r.method(http::Method::GET).f(|_| {
|
||||
HttpResponse::Found()
|
||||
.header("LOCATION", "/index.html")
|
||||
.finish()
|
||||
})
|
||||
})
|
||||
.handler("/static", StaticFiles::new("static").unwrap())
|
||||
}).bind_with("127.0.0.1:8443", move || acceptor.clone())
|
||||
})
|
||||
.bind_with("127.0.0.1:8443", move || acceptor.clone())
|
||||
.unwrap()
|
||||
.start();
|
||||
|
||||
println!("Started http server: 127.0.0.1:8443");
|
||||
let _ = sys.run();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user