Only nest if needed
This commit is contained in:
parent
b12fcef1b3
commit
4adc01c49c
1 changed files with 8 additions and 1 deletions
|
@ -47,7 +47,14 @@ async fn init(logger_initialized: &mut bool) -> Result<()> {
|
||||||
.with_state(app_state)
|
.with_state(app_state)
|
||||||
.nest_service("/static", static_service);
|
.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");
|
info!("Starting server");
|
||||||
Server::bind(&socket_address)
|
Server::bind(&socket_address)
|
||||||
|
|
Loading…
Reference in a new issue