Skip to content

Instantly share code, notes, and snippets.

@baygross
Created March 12, 2012 07:44
Show Gist options
  • Save baygross/2020528 to your computer and use it in GitHub Desktop.
Save baygross/2020528 to your computer and use it in GitHub Desktop.
Host a simple static site on heroku with Rack!
1) Create a sub-directory called 'public' in your root folder
2) Move all existing files (eg: index.html, images folder, etc) into this directory.
3) Add these three new files to root directory
4) run 'bundle install' to initialize
5) And test your server locally at http://localhost:3000 by running:
'rackup config.ru -p 3000'
#Example:
|-config.ru
|-app.rb
|-Gemfile
|-public/
|-index.html
|-main.css
|-images/
|-logo.png
|-fav.png
require 'sinatra'
get '/' do
File.open('public/index.html', File::RDONLY)
end
require './app'
run Sinatra::Application
source 'http://rubygems.org'
gem 'sinatra'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment