Only nest if needed

This commit is contained in:
Mo 2023-02-26 14:07:24 +01:00
parent b12fcef1b3
commit 4adc01c49c

View file

@ -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)