I have a Rails engine MyGreatEngine defined in a gem mge. This engine provides two types of routes, one related to APIs and one related to static files.
I would like to export two sets of routes, one for the API, and one for the static files. This would allow me to mount them in different places in the applications that use this engine. For instance, one could mount these routes respectively on /api/ and /static, while another one could mount them on /api/v1/ and /staticfiles/.
Since I haven't found a way to split the routes I have only two alternatives: I can either define two separate engines, and a third gem to implement the shared bits of them, or I can mount the engine at / and renounce the ability to customize the prefix in the application (so all applications will use /api/ and /static/). Both these approaches are problematic from my point of view.
You don't have to create a separate gem for every engine. One gem can contain multiple engines. You can specify routes for them separately, and easily share other functionality.
I'm pretty sure this should work out-of-the-box with zero extra configuration.