Getting started with sinatra

Your first Sinatra app

# app.rb
require 'sinatra'

get '/' do
    'Hello, Universe!'

Install Sinatra:

gem install sinatra

Run the app:

ruby app.rb

That’s it! Access your app at http://localhost:4567


You can install Sinatra as a global gem:

gem install sinatra

or add it to a project’s Gemfile

# in Gemfile:
gem 'sinatra'

and run bundle install.