Sinatra is a DSL for quickly creating web applications in Ruby with minimal effort.

If you already have a sinatra app, use it or go ahead and create one and add below code which basically has sinatra routes.


  get '/' do
    'Hey there!'

You need a Procfile file alongside your to tell Heroku how to run your app.

Example content of Procfile

web: bundle exec ruby web.rb -p $PORT

What this says is that run a web process on the port Heroku gives you using the bundle environment.


$:.unshift File.expand_path("../", __FILE__)
require 'rubygems'
require 'sinatra'
require './web

run Sinatra::Application
  • Array#unshift will prepend the new path to $:

  • File#expand_path is considered to be Ruby idiom for getting the absolute path to a file when you know the path relative to the current file.


Keep Coding !!!