actix-web : 1.0.7
actix-server: 0.6.0
I am trying to run two sites at different ports and stuck here.
Server::build()
.configure( |cfg : &mut ServiceConfig| {
cfg.bind( "site1", "0.0.0.0:8000").expect("bind failed");
cfg.bind( "site2", "0.0.0.0:9000").expect("bind failed");
cfg.apply(callback);
Ok(())
}).expect("Unable to bind")
.run();
fn callback(runtime : &mut ServiceRuntime) {
runtime.service("site1",
App::new()
.service(
web::resource("/iot/events")
.route(web::get().to(outbound))
)
);
}
Error :
error[E0271]: type mismatch resolving `<actix_web::app_service::AppInit<actix_web::app_service::AppEntry, actix_http::body::Body> as actix_service::NewService>::Request == actix_server_config::Io<tokio_tcp::stream::TcpStream>`
|
17 | runtime.service("site1", App::new()
| ^^^^^^^ expected struct `actix_http::request::Request`, found struct `actix_server_config::Io`
|
= note: expected type `actix_http::request::Request`
found type `actix_server_config::Io<tokio_tcp::stream::TcpStream>`
I don't know how to construct a actix_http::request::Request
here.
Thank you