Merging routing trees in different classes? #401
Replies: 1 comment
|
In Roda, you wouldn't be merging the routing trees. You would dispatch from one routing tree to another. To dispatch from a Roda app to another Roda app (or any Rack app), you would call If you want to have separate routing trees in the same Roda app, you generally would use the hash_branches plugin to split by segment, and use If you are asking if you can dispatch from a specific point in a routing tree from one Roda app to a specific place in the routing tree for another Roda app, the answer is no. Dispatching from one Roda app to another via One thing to understand is that the main routing tree for a Roda app is just a Ruby block that all requests are yielded to. Branches inside the routing tree are not saved anywhere, they only exist as Ruby code. If you are using one of the above plugins, the separate routing trees you define are saved somewhere, and it would be possible to dispatch directly to them if you know what you are doing, but I would not recommend that approach. Note that |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
My first roda subclass was for a biology-related web-interface. I was able to finish this quickly not long ago, as roda is actually surprisingly similar to sinatra.
I do have more projects, though, such as a web-project, a pdf-project (which mostly taps into hexapdf qpdf and prawn) and personal projects too. For these I kind of need:
a) different roda classes (each solving a corresponding sub-task)
and
b) the ability to merge these different routing trees together.
I can already use modules to delegate from a routing-tree entry point
into what the module does, so the module part I already have - I can
also use that in sinatra, so I could use different web-frameworks.
However had, how can I merge together different routes into a single
new tree?
In other words,
say we have class A and class B.
So this has the route /frequency_per_thousand but in class A.
Is there a way to merge all entry points of class B into either
class A or a new class? I am fine creating a new class. Right
now I don't know how to merge two different routing trees
together though. The route is defined via:
Is there a way to merge in different routes programmatically?
Or some other way to merge trees? I don't quite fully
understand how to modify the r.on() part or so yet.
All reactions