Rack (on rails) question:
Given I am loading a submodule into my Rails app,
And I want to serve static files from submodule's {folder_a, folder_b}
I cannot move the submodule's folder into /public
, because I only want
to serve some of the files from the submodule (and not all)
How do I configure Rack to do that?
My structure looks like this:
config.ru
submodule/public/folder_a/
submodule/public/folder_b/
public/
And I want the following mapping
submodule/public/folder_a => http://localhost:3000/folder_a
submodule/public/folder_b => http://localhost:3000/folder_b
What I tried so far:
use Rack::Static, :urls => ["/folder_a", "folder_b"], :root => "submodule/public"
That did not work, just no response on /folder_a
from my server. This idea was partly taken from the (old) question How to serve static files via Rack?, but it seems to suggest old resolutions which fails (currently my project is using Rack 1.5.2).
I also tried just symlinking my desired folders into /public, which works. But I am sure it will be prettier and more elegant to use Rack directly
Any suggestions?