Introduction
Sinatra is a Ruby-based domain-specific language and free and open source web application library. It serves as an alternative to Ruby on Rails, Merb, Nitro, and Camping, as well as other Ruby web application frameworks. The Rack web server interface is required. Frank Sinatra, a musician, inspired its name.

Blake Mizerany created and developed Sinatra, which is compact and adaptable. The standard model-view-controller pattern utilized by other frameworks, such as Ruby on Rails, is not followed by this one. Sinatra, on the other hand, concentrates on "quickly and simply building web applications in Ruby."It is also known as a "micro-framework" due to its considerably smaller size when compared to Ruby on Rails.
Sinatra is powerful enough to create a working web application from a single file. Sinatra is recognized as a good way for new developers to get started in Ruby web application development and can aid in learning for larger frameworks such as Rails.
CONFIGURING SETTINGS
Sinatra provides a variety of built-in options that determine whether or not specific functionalities are activated. Settings are application-level variables that can be changed using one of the set, enable, or disable methods and are accessible within the request context via the settings object. Applications are free to establish additional settings in addition to the framework's basic, built-in parameters.

The setting, enabling and disabling
The set method adds an attribute to the application using the setting name and value in its most basic form. Through the settings object, requests can access settings:
set : foo, 'bar'
get '/foo' do
"foo is set to " + settings.
foo
end
Deferring evaluation
Every time a setting value that is a Proc is read, an evaluation is carried out so that other settings may be used to calculate the value:
set : foo, 'bar'
set:baz, Proc. new { "Hello " + foo }
get '/baz' do
"baz is set to " + settings.
baz
end
If the foo option is left alone, the /baz response should read "baz is set to Hello bar."
Configuring multiple settings
By passing a Hash to a set, several settings can be changed. The previous illustration might be changed to read:
Set: foo => 'bar', : baz => Proc.new { "HI " + foo }
Using the enable and disable buttons to set multiple boolean values
Sugar for setting a collection of settings to true or false, respectively, is the enable and disable methods. The two codes shown below are comparable:

enable :sessions, :logging
disable :dump_errors, :some_custom_option
Using set:
set :sessions, true
set :logging, true
set :some_custom_option, false
set :dump_errors, false
Configuration
Run just once at startup, anywhere:
configure do
# setting one option
set :option, 'value'
# setting multiple options
set :a => 1, :b => 2
# same as `set :option, true`
enable :option
# same as `set :option, false`
disable :option
# you can also have dynamic settings with blocks
set(:css_dir) { File.join(views, 'CSS') }
end
Run only when the environment (APP_ENV environment variable) is set to
configure :production do
…….
end
Run in either the production or test environment:
configure :production, :test do
……
end
These choices are available through settings:
configure do
set :foo, 'bar'
end
get '/' do
settings.foo? # => true
settings.foo # => 'bar'
...
end






