Replies: 1 comment 1 reply
-
If you want to have completely different routes available per host, that seems to be a reason to use the route do |r|
case env['HTTP_HOST']
when 'user.example.com'
# user staff
when 'admin.example.com'
# admin stuff
end
# routing code
end You could definitely move the |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Beforehand: Thanks for Roda!
I'm a first-time Roda user, read the "Mastering Roda" manual and looked through Roda code and API documentation. So everything is still quite new for me 😃
I'm porting a rather small Rails app (just a service web app without even a database) to Roda and I want to ask for advice with regards to structuring the routes. The app provides different functionality based on the hostname, think an admin part and a user part.
After reading the documentation I see that I can use the "header_matchers" plugin to route by hostname:
Both, the user and admin parts share common functionality, like log-in. So I think that such functionality would need to be routed before routing by host name - is this correct?
And both parts are sufficiently complex/have 10+ routes that putting the routes into separate files would be advantageous. I thought about using the 'hash_branches' plugin but I'm not sure how to integrate that with the host matching.
Any advice on best practices in such a case would be really helpful - thank you!
Beta Was this translation helpful? Give feedback.
All reactions