From 4adc01c49c768b70f9fa630a8a6a84b8798d55bd Mon Sep 17 00:00:00 2001 From: Mo8it Date: Sun, 26 Feb 2023 14:07:24 +0100 Subject: [PATCH] Only nest if needed --- src/main.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 76129b7..7398113 100644 --- a/src/main.rs +++ b/src/main.rs @@ -47,7 +47,14 @@ async fn init(logger_initialized: &mut bool) -> Result<()> { .with_state(app_state) .nest_service("/static", static_service); - let app = Router::new().nest(&path_prefix, routes); + let app = { + if path_prefix == "/" { + // No need to nest. + routes + } else { + Router::new().nest(&path_prefix, routes) + } + }; info!("Starting server"); Server::bind(&socket_address)