Skip to content

Commit

Permalink
templates: revert to avoid breakage, move this change to 0.12 future …
Browse files Browse the repository at this point in the history
…release
  • Loading branch information
jondot committed Oct 23, 2024
1 parent dcf7345 commit 5373231
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
4 changes: 3 additions & 1 deletion starters/lightweight-service/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<()> {
Expand Down
2 changes: 1 addition & 1 deletion starters/lightweight-service/src/controllers/home.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ async fn current() -> Result<Response> {
}

pub fn routes() -> Routes {
Routes::new().prefix("/api").add("/", get(current))
Routes::new().add("/", get(current))
}
1 change: 1 addition & 0 deletions starters/rest-api/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion starters/rest-api/src/controllers/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ async fn login(State(ctx): State<AppContext>, Json(params): Json<LoginParams>) -

pub fn routes() -> Routes {
Routes::new()
.prefix("api/auth")
.prefix("auth")
.add("/register", post(register))
.add("/verify", post(verify))
.add("/login", post(login))
Expand Down
2 changes: 1 addition & 1 deletion starters/rest-api/src/controllers/notes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub async fn get_one(Path(id): Path<i32>, State(ctx): State<AppContext>) -> Resu

pub fn routes() -> Routes {
Routes::new()
.prefix("api/notes")
.prefix("notes")
.add("/", get(list))
.add("/", post(add))
.add("/:id", get(get_one))
Expand Down
4 changes: 1 addition & 3 deletions starters/rest-api/src/controllers/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,5 @@ async fn current(auth: auth::JWT, State(ctx): State<AppContext>) -> Result<Respo
}

pub fn routes() -> Routes {
Routes::new()
.prefix("api/user")
.add("/current", get(current))
Routes::new().prefix("user").add("/current", get(current))
}

0 comments on commit 5373231

Please sign in to comment.