Deploy Sinatra app on Heroku

前端 未结 5 587
后悔当初
后悔当初 2020-12-23 14:58

I have simple Sinatra app.

web.rb:

require \'sinatra\'

get \'/\' do 
    \"Hello\" 
end

Gemfile:*

5条回答
  •  时光说笑
    2020-12-23 15:45

    As an update, here is a slightly more minimal app that I created, and confirmed to be working as of today. The thin gem was not needed, and a Procfile was not needed to get an initial working app.

    Gemfile

    source 'https://rubygems.org'
    gem 'sinatra'
    

    config.ru

    require './app'
    
    run Sinatra::Application
    

    Note: The require line uses './app' instead of 'app'.

    app.rb

    require 'sinatra'
    
    get '/' do
      'Hello, World! Find me in app.rb'
    end
    

    If you want to use this template, you can copy it, bundle, and push the Git repo.

    $ git init
    $ git add .
    $ git commit -m "initial sinatra app"
    $ bundle
    $ git add Gemfile.lock
    $ git commit -m "bundle install"
    $ heroku create
    $ git push heroku master
    $ heroku open
    

提交回复
热议问题