renamed Route::handler to Route::f, added Route::h to register Handler

This commit is contained in:
Nikolay Kim 2017-12-04 14:07:53 -08:00
parent 03f7d95d88
commit f5d6179a34
19 changed files with 79 additions and 40 deletions

View file

@ -108,8 +108,8 @@ fn main() {
HttpServer::new(
Application::default("/")
.middleware(middlewares::Logger::default()) // <- register logger middleware
.resource("/ws/", |r| r.method(Method::GET)
.handler(|req| ws::start(req, MyWebSocket))) // <- websocket route
.resource("/ws/", |r|
r.method(Method::GET).f(|req| ws::start(req, MyWebSocket))) // <- websocket route
.route("/", fs::StaticFiles::new("examples/static/", true))) // <- serve static files
.serve::<_, ()>("127.0.0.1:8080").unwrap();