Created
March 6, 2009 05:50
-
-
Save mcroydon/74778 to your computer and use it in GitHub Desktop.
This file contains 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
# You'll need to require these if you | |
# want to develop while running with ruby. | |
# The config/rackup.ru requires these as well | |
# for it's own reasons. | |
# | |
# $ ruby sinatra-test.rb | |
# | |
require 'rubygems' | |
require 'sinatra' | |
require 'json' | |
configure :production do | |
# Configure stuff here you'll want to | |
# only be run at Heroku at boot | |
# TIP: You can get you database information | |
# from ENV['DATABASE_URI'] (see /env route below) | |
end | |
# Quick test | |
get '/' do | |
"Congradulations! | |
You're running a Sinatra application on Heroku!" | |
end | |
get '/hello' do | |
content_type 'text/json' | |
{:message => 'Hello, World!'}.to_json | |
end | |
get '/world' do | |
haml :world | |
end | |
# Test at <appname>.heroku.com | |
# You can see all your app specific information this way. | |
# IMPORTANT! This is a very bad thing to do for a production | |
# application with sensitive information | |
# get '/env' do | |
# ENV.inspect | |
# end | |
__END__ | |
@@ world | |
.content Hello, Haml! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment