mirror of
https://github.com/actix/actix-extras.git
synced 2025-06-25 09:59:21 +02:00
http server accepts factory of HttpHandlers
This commit is contained in:
@ -57,7 +57,7 @@ fn main() {
|
||||
let sys = actix::System::new("ws-example");
|
||||
|
||||
HttpServer::new(
|
||||
Application::new()
|
||||
|| Application::new()
|
||||
// enable logger
|
||||
.middleware(middlewares::Logger::default())
|
||||
// cookie session middleware
|
||||
|
@ -54,13 +54,14 @@ impl Handler<ws::Message> for MyWebSocket {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fn main() {
|
||||
::std::env::set_var("RUST_LOG", "actix_web=info");
|
||||
let _ = env_logger::init();
|
||||
let sys = actix::System::new("ws-example");
|
||||
|
||||
HttpServer::new(
|
||||
Application::with_state(AppState{counter: Cell::new(0)})
|
||||
|| Application::with_state(AppState{counter: Cell::new(0)})
|
||||
// enable logger
|
||||
.middleware(middlewares::Logger::default())
|
||||
// websocket route
|
||||
|
@ -61,7 +61,7 @@ fn main() {
|
||||
let sys = actix::System::new("ws-example");
|
||||
|
||||
HttpServer::new(
|
||||
Application::new()
|
||||
|| Application::new()
|
||||
// enable logger
|
||||
.middleware(middlewares::Logger::default())
|
||||
// websocket route
|
||||
|
Reference in New Issue
Block a user