Skip to content

Instantly share code, notes, and snippets.

@bmarini
Created May 25, 2012 17:51
Show Gist options
  • Save bmarini/2789471 to your computer and use it in GitHub Desktop.
Save bmarini/2789471 to your computer and use it in GitHub Desktop.
Goliath app to serve static files
require 'goliath'
# require 'goliath/rack/templates'
# require 'haml'
# $:.unshift File.expand_path('../lib', __FILE__)
class StaticAndTemplateFiles < Goliath::API
# include Goliath::Rack::Templates
use( Rack::Static,
:root => Goliath::Application.app_path('public'),
:urls => ['/'],
:cache_control => 'public, max-age=3600'
)
def response(env)
[ 200, {"Content-Type" => "text/html"}, [""] ]
end
end
class App < Goliath::API
map '/', StaticAndTemplateFiles
end
web: bundle exec ruby app.rb -sv -e prod -p $PORT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment