Public
Allows apps to use more than one public folder.
Description
This is used by the Main application. This is a general-purpose plugin that can be used in other Sinatra projects.
Usage
class MyApp < Sinatra::Base
register Aura::Public
add_public path
add_public path[, :prefix => PREFIX]
end
Example
Add a public dir
Just pass a path to add_public
.
class MyApp < Sinatra::Base
add_public "#root/app/public"
end
Accessing
This may be used to access app/public/script.js
.
$ curl http://localhost:4567/script.js
Prefix
Here's how you add a prefix.
add_public "#root/js", :prefix => "javascripts/"
$ curl http://localhost:4567/javascripts/app.js
Class methods
- add_public Adds a new public dir.