diff --git a/examples/tls/src/main.rs b/examples/tls/src/main.rs index 886049d19..d40719e56 100644 --- a/examples/tls/src/main.rs +++ b/examples/tls/src/main.rs @@ -30,11 +30,11 @@ fn main() { let pkcs12 = Pkcs12::from_der(&pkcs12).unwrap().parse("12345").unwrap(); HttpServer::new( - Application::default("/") + Application::new("/") // enable logger .middleware(middlewares::Logger::default()) // register simple handler, handle all methods - .route("/index.html", |r| r.f(index)) + .resource("/index.html", |r| r.f(index)) // with path parameters .resource("/", |r| r.method(Method::GET).f(|req| { httpcodes::HTTPFound diff --git a/examples/websocket-chat/src/main.rs b/examples/websocket-chat/src/main.rs index 797d4690c..7547b505d 100644 --- a/examples/websocket-chat/src/main.rs +++ b/examples/websocket-chat/src/main.rs @@ -197,7 +197,7 @@ fn main() { // Create Http server with websocket support HttpServer::new( - Application::build("/", state) + Application::with_state("/", state) // redirect to websocket.html .resource("/", |r| r.method(Method::GET).f(|req| { httpcodes::HTTPFound @@ -208,7 +208,7 @@ fn main() { // websocket .resource("/ws/", |r| r.route().f(chat_route)) // static resources - .route("/static", |r| r.h(fs::StaticFiles::new("static/", true)))) + .resource("/static", |r| r.h(fs::StaticFiles::new("static/", true)))) .serve::<_, ()>("127.0.0.1:8080").unwrap(); let _ = sys.run();