rackrack-pow

Pow config.ru for serving static files outside of the public directory?


How do you setup a config.ru file to have Pow serve html/css/js files outside of the public directory? Let's say I wanted to serve them out of the html folder instead.


Solution

  • You could use TryStatic from rack-contrib:

    require 'rack/contrib/try_static'
    
    use Rack::TryStatic,
      :root => "html",
      :urls => %w[/]
    

    You might want to add if ENV['RACK_ENV'] == 'development' if you only want this during development (e.g. if your web server is configured to serve from html/) .