introduce route predicates

This commit is contained in:
Nikolay Kim 2017-12-04 13:32:05 -08:00
parent 57fd35ffc1
commit 3bf3738e65
20 changed files with 370 additions and 122 deletions

View file

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