- println!("Listening on: {}:{}, open browser and visit have a try!", appstate.settings.http.bind_ip, appstate.settings.http.bind_port);
- HttpServer::new(move || {
- App::new()
- .app_data(web::Data::new(AppState {
- settings: Settings::new().unwrap(),
- }))
- .wrap(middleware::Logger::default()) // enable logger
- .service(web::resource("/").route(web::get().to(index)))
- .service(web::scope("").wrap(error_handlers()))
- })
- .bind((appstate.settings.http.bind_ip, appstate.settings.http.bind_port))?
- .run()
- .await
-}