diff --git a/README.md b/README.md index b24a310a6..866e143cd 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,6 @@ extern crate env_logger; use actix::*; use actix_web::*; - struct MyWebSocket; /// Actor with http context @@ -112,7 +111,8 @@ fn main() { .middleware(middlewares::Logger::default()) // websocket route .resource("/ws/", |r| r.get(|req| ws::start(req, MyWebSocket))) - .route_handler("/", StaticFiles::new("examples/static/", true))) + // static files + .route("/", StaticFiles::new("examples/static/", true))) .serve::<_, ()>("127.0.0.1:8080").unwrap(); Arbiter::system().send(msgs::SystemExit(0)); diff --git a/src/dev.rs b/src/dev.rs index cd8b7a8a7..8ec4a50d1 100644 --- a/src/dev.rs +++ b/src/dev.rs @@ -10,7 +10,6 @@ // dev specific pub use task::Task; -pub use route::Handler; pub use pipeline::Pipeline; pub use recognizer::RouteRecognizer; pub use channel::HttpChannel; diff --git a/src/lib.rs b/src/lib.rs index c94e67897..2142e5474 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -82,7 +82,7 @@ pub use application::Application; pub use httprequest::{HttpRequest, UrlEncoded}; pub use httpresponse::HttpResponse; pub use payload::{Payload, PayloadItem}; -pub use route::{Frame, Reply}; +pub use route::{Frame, Reply, Handler}; pub use resource::Resource; pub use recognizer::Params; pub use server::HttpServer; diff --git a/src/resource.rs b/src/resource.rs index f485b5186..4fcd99227 100644 --- a/src/resource.rs +++ b/src/resource.rs @@ -80,28 +80,28 @@ impl Resource where S: 'static { self.default = Box::new(WrapHandler::new(handler)); } - /// Handler for `GET` method. + /// Register handler for `GET` method. pub fn get(&mut self, handler: F) where F: Fn(HttpRequest) -> R + 'static, R: Into + 'static, { self.routes.insert(Method::GET, Box::new(WrapHandler::new(handler))); } - /// Handler for `POST` method. + /// Register handler for `POST` method. pub fn post(&mut self, handler: F) where F: Fn(HttpRequest) -> R + 'static, R: Into + 'static, { self.routes.insert(Method::POST, Box::new(WrapHandler::new(handler))); } - /// Handler for `PUT` method. + /// Register handler for `PUT` method. pub fn put(&mut self, handler: F) where F: Fn(HttpRequest) -> R + 'static, R: Into + 'static, { self.routes.insert(Method::PUT, Box::new(WrapHandler::new(handler))); } - /// Handler for `DELETE` method. + /// Register handler for `DELETE` method. pub fn delete(&mut self, handler: F) where F: Fn(HttpRequest) -> R + 'static, R: Into + 'static, {