Right now all of the route controllers are mounted at the top-level "/" route, so all of their routes need to define their full route. e.g. /api/v1/result/list. Ideally each controller should be mounted in its own namespace and their routes defined relative to their mount.
I don't know if this is possible with Sinatra, but would improve readability IMO.
Right now all of the route controllers are mounted at the top-level "/" route, so all of their routes need to define their full route. e.g. `/api/v1/result/list`. Ideally each controller should be mounted in its own namespace and their routes defined relative to their mount.
I don't know if this is possible with Sinatra, but would improve readability IMO.
gballan
added the bug label 2025-08-13 13:04:01 -04:00
Unfortunately, the map method that AI recommended is meant to be put in the config.ru file. This solution might work, but would make testing a bit more wonky. I'll want to see what other impact that change might have before making that change.
Another option could be to define a route prefix in each controller and make the routes concatenate that variable:
classBenchmarkController<BaseControllerROUTE_PREFIX='/benchmark'get"#{ROUTE_PREFIX}/list' do
# things for the route
end
end
Only issue with this is it would mean EVERY ROUTE would need to compute/concatenate their route, instead of just using a static string.
Unfortunately, the `map` method that AI recommended is meant to be put in the `config.ru` file. This solution might work, but would make testing a bit more wonky. I'll want to see what other impact that change might have before making that change.
Another option could be to define a route prefix in each controller and make the routes concatenate that variable:
```ruby
class BenchmarkController < BaseController
ROUTE_PREFIX = '/benchmark'
get "#{ROUTE_PREFIX}/list' do
# things for the route
end
end
```
Only issue with this is it would mean EVERY ROUTE would need to compute/concatenate their route, instead of just using a static string.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Right now all of the route controllers are mounted at the top-level "/" route, so all of their routes need to define their full route. e.g.
/api/v1/result/list. Ideally each controller should be mounted in its own namespace and their routes defined relative to their mount.I don't know if this is possible with Sinatra, but would improve readability IMO.
Unfortunately, the
mapmethod that AI recommended is meant to be put in theconfig.rufile. This solution might work, but would make testing a bit more wonky. I'll want to see what other impact that change might have before making that change.Another option could be to define a route prefix in each controller and make the routes concatenate that variable:
Only issue with this is it would mean EVERY ROUTE would need to compute/concatenate their route, instead of just using a static string.