diff --git a/starters/lightweight-service/src/app.rs b/starters/lightweight-service/src/app.rs index 4796bc1fc..2e7fff178 100644 --- a/starters/lightweight-service/src/app.rs +++ b/starters/lightweight-service/src/app.rs @@ -35,7 +35,9 @@ impl Hooks for App { } fn routes(_ctx: &AppContext) -> AppRoutes { - AppRoutes::empty().add_route(controllers::home::routes()) + AppRoutes::empty() + .prefix("/api") + .add_route(controllers::home::routes()) } async fn connect_workers(_ctx: &AppContext, _queue: &Queue) -> Result<()> { diff --git a/starters/lightweight-service/src/controllers/home.rs b/starters/lightweight-service/src/controllers/home.rs index 0d6430f60..d3330ebb5 100644 --- a/starters/lightweight-service/src/controllers/home.rs +++ b/starters/lightweight-service/src/controllers/home.rs @@ -9,5 +9,5 @@ async fn current() -> Result { } pub fn routes() -> Routes { - Routes::new().prefix("/api").add("/", get(current)) + Routes::new().add("/", get(current)) } diff --git a/starters/rest-api/src/app.rs b/starters/rest-api/src/app.rs index 8b191321b..c2f802bcc 100644 --- a/starters/rest-api/src/app.rs +++ b/starters/rest-api/src/app.rs @@ -44,6 +44,7 @@ impl Hooks for App { fn routes(_ctx: &AppContext) -> AppRoutes { AppRoutes::with_default_routes() + .prefix("/api") .add_route(controllers::notes::routes()) .add_route(controllers::auth::routes()) .add_route(controllers::user::routes()) diff --git a/starters/rest-api/src/controllers/auth.rs b/starters/rest-api/src/controllers/auth.rs index 9978d9d21..dba78a3e9 100644 --- a/starters/rest-api/src/controllers/auth.rs +++ b/starters/rest-api/src/controllers/auth.rs @@ -141,7 +141,7 @@ async fn login(State(ctx): State, Json(params): Json) - pub fn routes() -> Routes { Routes::new() - .prefix("api/auth") + .prefix("auth") .add("/register", post(register)) .add("/verify", post(verify)) .add("/login", post(login)) diff --git a/starters/rest-api/src/controllers/notes.rs b/starters/rest-api/src/controllers/notes.rs index c95aa3e39..f378fb4d8 100644 --- a/starters/rest-api/src/controllers/notes.rs +++ b/starters/rest-api/src/controllers/notes.rs @@ -66,7 +66,7 @@ pub async fn get_one(Path(id): Path, State(ctx): State) -> Resu pub fn routes() -> Routes { Routes::new() - .prefix("api/notes") + .prefix("notes") .add("/", get(list)) .add("/", post(add)) .add("/:id", get(get_one)) diff --git a/starters/rest-api/src/controllers/user.rs b/starters/rest-api/src/controllers/user.rs index a7c0af334..1f432ae9e 100644 --- a/starters/rest-api/src/controllers/user.rs +++ b/starters/rest-api/src/controllers/user.rs @@ -10,7 +10,5 @@ async fn current(auth: auth::JWT, State(ctx): State) -> Result Routes { - Routes::new() - .prefix("api/user") - .add("/current", get(current)) + Routes::new().prefix("user").add("/current", get(current)) }