mostly working for two projects (broke 404 handler, index)

This commit is contained in:
Brandon Thomas committed 2021-11-09 23:12:04 -05:00
1 parent d0c156718a
commit aa38f0a71f
3 files changed
+14 -5

No files matched your search

@@ -2,7 +2,16 @@ use actix_http::http::StatusCode;
use actix_web::{HttpResponse, HttpRequest, Responder, get};
use log::debug;
#[get("/")]
/*
error[E0277]: the trait bound `fn() -> impl futures::Future {get_root_index}: HttpServiceFactory` is not satisfied
--> app/storyteller_web/src/main.rs:627:16
|
627 | .service(get_root_index)
| ^^^^^^^^^^^^^^ the trait `HttpServiceFactory` is not implemented for `fn() -> impl futures::Future {get_root_index}`
*/
pub async fn get_root_index() -> impl Responder {
debug!("GET /"); // NB: Google load balancer hits this a lot, and it spams.
HttpResponse::build(StatusCode::OK)
+2 -2
View File
@@ -31,7 +31,7 @@ use crate::twitch::twitch_secrets::TwitchSecrets;
use crate::twitch::websocket_client::PollingTwitchWebsocketClient;
use futures::Future;
use futures::executor::ThreadPool;
//use http_server_common::cors::build_common_cors_config;
use http_server_common::cors::build_common_cors_config;
use http_server_common::endpoints::default_route_404::default_route_404;
use http_server_common::endpoints::root_index::get_root_index;
use limitation::Limiter;
@@ -308,7 +308,7 @@ pub async fn serve(server_state: ObsGatewayServerState) -> AnyhowResult<()>
HttpServer::new(move || {
App::new()
.app_data(server_state_arc.clone())
//.wrap(build_common_cors_config())
.wrap(build_common_cors_config())
.wrap(Logger::new(&log_format)
.exclude("/liveness")
.exclude("/readiness"))
+2 -2
View File
@@ -624,10 +624,10 @@ pub async fn serve(server_state: ServerState) -> AnyhowResult<()>
.route(web::get().to(leaderboard_handler))
.route(web::head().to(|| HttpResponse::Ok()))
)
.service(get_root_index)
//.service(get_root_index)
.service(enable_alpha_handler)
.service(enable_alpha_easy_handler)
.default_service( web::route().to(default_route_404))
//.default_service( web::route().to(default_route_404))
})
.bind(bind_address)?
.workers(num_workers)