Closed ezekielriva closed 7 years ago
Hi @ezekielriva! I understand what you want to do: you would like to embed all the routes defined in V1::Settings
and V1::Setups
. The way run
works is it just handles over the control to the sub app, so it halts the request no matter what happens inside this other app. We can try something to see if it works for your use case. Try adding this code:
class Cuba
def mount(app)
result = app.call(req.env)
halt result if result[0] != 404
end
end
Then, in your application, you can use it like this:
Cuba.define do
on default do
mount A
mount B
end
end
It should halt the request only if the resulting status from calling the mounted app is not 404
. If you run into unexpected issues, let me know and I'll try to fix the implementation. If it all works, we can write a plugin that provides this code.
Let me know how it goes!
For example I have this
Currently that does not work, I have a bunch of endpoint on each Cuba class and I'd like to mount them using only
run
method.I'm not pretty sure but Grape mount the endpoints like my approach using the
mount
method.