O'Reilly logo

Instant Sinatra Starter by Joe Yates

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Top 18 features you need to know about

As you start to use Sinatra, you will realize that there are a wide variety of things that you can do with it. This section will teach you all about the most commonly performed tasks and most commonly used features in Sinatra.

Sinatra application types

They are of the following two types:

Classic applications

Sinatra applications can be created in a single file with very little "boilerplate"—just call require 'sinatra' and start writing code. The advantage of these applications is that they are easy to create and comprehend, so they reduce the difficulty for beginners.

The following is a small example. We're using the classic_app.rb file here.

require 'sinatra'

get '/' do
  'A Sinatra classic application'
end

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required