Skip to content

Instantly share code, notes, and snippets.

@amitittyerah
Created April 11, 2014 04:59
Show Gist options
  • Save amitittyerah/10441608 to your computer and use it in GitHub Desktop.
Save amitittyerah/10441608 to your computer and use it in GitHub Desktop.
Simple webserver with Rack
$ sudo apt-get install ruby-bundler
# Gemfile
source :rubygems
gem 'rack'
$ bundler install
# config.ru
use Rack::Static,
:urls => ["/assets"],
:root => "public"
run lamda { |env|
[
200,
{
'Content-Type' => 'text/html',
'Cache-Control' => 'public, max-age=3600'
},
File.open('public/index.html', File::RDONLY)
]
}
$ rackup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment