LoginSignup
2
3

More than 5 years have passed since last update.

sinatra boilerplate

Last updated at Posted at 2013-11-24

なんで sinatra new みたいなコマンド無いんだろう。

app.rb
get '/' do
  if @something_goes_wrong
    halt 400, "oops"
  end
  'hello world'
end
config.ru
require 'bundler'
Bundler.require
$stdout.sync = true # https://devcenter.heroku.com/articles/getting-started-with-ruby#logging               
require './app'
run Sinatra::Application
Gemfile
source "https://rubygems.org"
gem "sinatra"

ローカルで実行するときは rackupshotgun

heroku にデプロイする場合は

git init
git add app.rb config.ru Gemfile Gemfile.lock
git commit -m 'initial commit'
heroku create your-app-name
git push heroku master
heroku open
2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3