Created
March 12, 2012 07:44
-
-
Save baygross/2020528 to your computer and use it in GitHub Desktop.
Host a simple static site on heroku with Rack!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
get '/' do | |
File.open('public/index.html', File::RDONLY) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require './app' | |
run Sinatra::Application |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'http://rubygems.org' | |
gem 'sinatra' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment