refactor server router

This commit is contained in:
Nikolay Kim 2017-10-21 18:54:24 -07:00
parent 0d6e42e748
commit 6a33b65f02
10 changed files with 173 additions and 373 deletions

View file

@ -58,17 +58,13 @@ impl Handler<ws::Message> for MyWebSocket {
}
}
fn main() {
let sys = actix::System::new("ws-example");
HttpServer::new(
RoutingMap::default()
Application::default("/")
.resource("/ws/", |r| r.get::<MyWebSocket>())
.app("/", Application::default()
.route_handler("/", StaticFiles::new("static/", true))
.finish())
.finish())
.route_handler("/", StaticFiles::new("static/", true)))
.serve::<_, ()>("127.0.0.1:8080").unwrap();
println!("Started http server: 127.0.0.1:8080");