1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 06:39:22 +02:00

refactor server bind and start process

This commit is contained in:
Nikolay Kim
2017-12-17 12:35:04 -08:00
parent 4b421b44a2
commit 27d92f3a23
10 changed files with 139 additions and 103 deletions

View File

@ -93,7 +93,8 @@ fn main() {
.header("LOCATION", "/index.html")
.body(Body::Empty)
})))
.serve::<_, ()>("127.0.0.1:8080").unwrap();
.bind("127.0.0.1:8080").unwrap()
.start().unwrap();
println!("Started http server: 127.0.0.1:8080");
let _ = sys.run();

View File

@ -70,7 +70,8 @@ fn main() {
r.method(Method::GET).f(|req| ws::start(req, MyWebSocket{counter: 0})))
// register simple handler, handle all methods
.resource("/", |r| r.f(index)))
.serve::<_, ()>("127.0.0.1:8080").unwrap();
.bind("127.0.0.1:8080").unwrap()
.start().unwrap();
println!("Started http server: 127.0.0.1:8080");
let _ = sys.run();

View File

@ -70,7 +70,8 @@ fn main() {
.resource("/{tail:.*}",
|r| r.h(fs::StaticFiles::new("tail", "examples/static/", true))))
// start http server on 127.0.0.1:8080
.serve::<_, ()>("127.0.0.1:8080").unwrap();
.bind("127.0.0.1:8080").unwrap()
.start().unwrap();
println!("Started http server: 127.0.0.1:8080");
let _ = sys.run();