Sinatra is a
free and open source software
Free and open-source software (FOSS) is a term used to refer to groups of software consisting of both free software and open-source software where anyone is freely licensed to use, copy, study, and change the software in any way, and the source ...
web application library and
domain-specific language written in
Ruby
A ruby is a pinkish red to blood-red colored gemstone, a variety of the mineral corundum (aluminium oxide). Ruby is one of the most popular traditional jewelry gems and is very durable. Other varieties of gem-quality corundum are called sapp ...
. It is an alternative to other Ruby web application frameworks such as
Ruby on Rails,
Merb, Nitro, and
Camping
Camping is an outdoor activity involving overnight stays away from home, either without shelter or using basic shelter such as a tent, or a recreational vehicle. Typically, participants leave developed areas to spend time outdoors in more natu ...
. It is dependent on the
Rack web server interface. It is named after musician
Frank Sinatra.
[Sinatra: About](_blank)
/ref>
Designed and developed by Blake Mizerany, Sinatra is small and flexible. It does not follow the typical model–view–controller
Model–view–controller (MVC) is a software architectural pattern commonly used for developing user interfaces that divide the related program logic into three interconnected elements. This is done to separate internal representations of infor ...
pattern used in other frameworks, such as Ruby on Rails. Instead, Sinatra focuses on "quickly creating web-applications in Ruby with minimal effort." Because of much smaller size compared to Ruby on Rails, it is also called ''microframework''.
Some notable companies and institutions that use Sinatra include Apple
An apple is an edible fruit produced by an apple tree (''Malus domestica''). Apple trees are cultivated worldwide and are the most widely grown species in the genus '' Malus''. The tree originated in Central Asia, where its wild ances ...
, BBC, the British Government's Government Digital Service, LinkedIn, the National Security Agency
The National Security Agency (NSA) is a national-level intelligence agency of the United States Department of Defense, under the authority of the Director of National Intelligence (DNI). The NSA is responsible for global monitoring, collectio ...
, Engine Yard, Heroku, GitHub
GitHub, Inc. () is an Internet hosting service for software development and version control using Git. It provides the distributed version control of Git plus access control, bug tracking, software feature requests, task management, co ...
, Stripe
Stripe, striped, or stripes may refer to:
Decorations
* Stripe (pattern), a line or band that differs in colour or tone from an adjacent surface
* Racing stripe, a vehicle decoration
* Service stripe, a decoration of the U.S. military
Entertainme ...
, and Songbird. Travis CI provides much of the financial support for Sinatra's development.
Sinatra was created and open-sourced in 2007. It inspired multiple ports and similar projects in other programming languages, such as Express.js
Express.js, or simply Express, is a back end web application framework for building RESTful APIs with Node.js, released as free and open-source software under the MIT License. It is designed for building web applications and APIs. It has been ...
and Scalatra.
Mizerany and Heroku's Adam Wiggins introduced and discussed Sinatra at RubyConf
Ruby Central, Inc., is a non-profit organization based in the United States, dedicated to support and advocacy for the Ruby programming language.
Ruby Central is the parent organization of the annual International Ruby and Ruby on Rails Conferenc ...
2008.Confreaks: RubyConf 2008
Example
#!/usr/bin/env ruby
require 'sinatra'
get '/' do
redirect to('/hello/World')
end
get '/hello/:name' do
"Hello #!"
end
References
Further reading
*
*
*
External links
*
{{Application frameworks
Articles with example Ruby code
Free software programmed in Ruby
Software using the MIT license
Web frameworks