fix: use merge instead of nesting
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful

This commit is contained in:
Radical 2025-07-17 16:48:34 +02:00
parent 1946080716
commit 9a0ebf2b2f
2 changed files with 4 additions and 4 deletions

View file

@ -9,8 +9,8 @@ use crate::AppState;
mod v1; mod v1;
mod versions; mod versions;
pub fn router() -> Router<Arc<AppState>> { pub fn router(path: &str) -> Router<Arc<AppState>> {
Router::new() Router::new()
.route("/versions", get(versions::versions)) .route(&format!("{path}/versions"), get(versions::versions))
.nest("/v1", v1::router()) .nest(&format!("{path}/v1"), v1::router())
} }

View file

@ -141,7 +141,7 @@ async fn main() -> Result<(), Error> {
// build our application with a route // build our application with a route
let app = Router::new() let app = Router::new()
// `GET /` goes to `root` // `GET /` goes to `root`
.nest(web.backend_url.path(), api::router()) .merge(api::router(web.backend_url.path().trim_end_matches("/")))
.with_state(app_state) .with_state(app_state)
.layer(cors) .layer(cors)
.layer(socket_io); .layer(socket_io);