Skip to content

Instantly share code, notes, and snippets.

@vitobotta
Forked from jlindsey/config.ru
Created June 4, 2012 21:41
Show Gist options
  • Save vitobotta/2870993 to your computer and use it in GitHub Desktop.
Save vitobotta/2870993 to your computer and use it in GitHub Desktop.
Simplest rack app
require 'rack'
map '/' do
use Rack::Static, urls: ['/assets', '/templates'], root: File.expand_path('../public', __FILE__)
app = lambda do |env|
headers = {
'Content-Type' => 'text/html',
'Cache-Control' => 'no-cache'
}
body = File.open(File.expand_path('../public/index.html', __FILE__), File::RDONLY).read
[200, headers, [body]]
end
run app
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment