fix: use merge instead of nesting
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
This commit is contained in:
parent
1946080716
commit
9a0ebf2b2f
2 changed files with 4 additions and 4 deletions
|
@ -9,8 +9,8 @@ use crate::AppState;
|
|||
mod v1;
|
||||
mod versions;
|
||||
|
||||
pub fn router() -> Router<Arc<AppState>> {
|
||||
pub fn router(path: &str) -> Router<Arc<AppState>> {
|
||||
Router::new()
|
||||
.route("/versions", get(versions::versions))
|
||||
.nest("/v1", v1::router())
|
||||
.route(&format!("{path}/versions"), get(versions::versions))
|
||||
.nest(&format!("{path}/v1"), v1::router())
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ async fn main() -> Result<(), Error> {
|
|||
// build our application with a route
|
||||
let app = Router::new()
|
||||
// `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)
|
||||
.layer(cors)
|
||||
.layer(socket_io);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue