I'm using an actix-web server as a visualizer for my simulator. It's been running with actix-web 1.0 for a long time, but I decided to update it to 2.0. Converting the client in the simulator went fine, but I've hit a wall with the server. The code compiles, but no matter what I do, I get
App data is not configured, to configure use App::data()
when I click the one button on the web page.
Here's a small(ish) case that causes the error.
#[actix_rt::main]
async fn main() {
let index_data = web::Data::new("index.html");
let geo_data = web::Data::new(geometry::AppGeometry::default());
let hello_data = web::Data::new(hello::AppCells::default());
HttpServer::new(move || {
App::new()
.app_data(index_data.clone())
.app_data(hello_data.clone())
.app_data(geo_data.clone())
.route("/",web::get().to(index::index))
.service(replay::post())
})
.keep_alive(100usize)
.bind("127.0.0.1:8088")
.unwrap()
.run()
.await
.unwrap();
}
replay::post()
uses AppGeometry and AppCells, but it isn't small.
I've searched web, and I tried data
instead of app_data
.