Skip to content

Instantly share code, notes, and snippets.

@mcroydon
Created March 6, 2009 05:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcroydon/74778 to your computer and use it in GitHub Desktop.
Save mcroydon/74778 to your computer and use it in GitHub Desktop.
# 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