GemfileThe gemfile is pretty basic, set a source for gems and include the sinatra gem.
source :rubygems gem 'sinatra'
config.ruThis is the rackup config file which sets the app up to run in rack.
require 'rubygems' require 'bundler' Bundler.require require './myapp' run MyApp
myapp.rbThis is the sinatra file. Note that I defined a class (MyApp). This is very important because our config.ru needs the class as a handle for the 'run MyApp' call. An alternative would be to use "run Sinatra::Application" in your config.ru file.
class MyApp < Sinatra::Base get '/' do 'Hello world!' end end
Running locallyFirst make sure rack is installed, then run the following commands in the root folder and the app should be up and running locally.
bundle install rackup
Deploying to HerokuJust run the following commands in the root folder and the app should be up and running on Heroku.
git init git add . git commit -m 'Initial version of MyApp' heroku create git push heroku master