Sinatra is a
free and open source software
Free and open-source software (FOSS) is software available under a Software license, license that grants users the right to use, modify, and distribute the software modified or not to everyone free of charge. FOSS is an inclusive umbrella term ...
web application
A web application (or web app) is application software that is created with web technologies and runs via a web browser. Web applications emerged during the late 1990s and allowed for the server to dynamically build a response to the request, ...
library and
domain-specific language
A domain-specific language (DSL) is a computer language specialized to a particular application domain. This is in contrast to a general-purpose language (GPL), which is broadly applicable across domains. There are a wide variety of DSLs, ranging ...
written in
Ruby
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 sapph ...
. It is an alternative to other Ruby web application frameworks such as
Ruby on Rails
Ruby on Rails (simplified as Rails) is a server-side web application framework written in Ruby under the MIT License. Rails is a model–view–controller (MVC) framework, providing default structures for a database, a web service, and web pa ...
,
Merb, Nitro, and Camping. It is dependent on the
Rack
Rack or racks may refer to:
Storage, support and transportation
* Amp rack, a piece of furniture in which amplifiers are mounted
* Autorack or auto carrier, for transporting vehicles in freight trains
* Baker's rack, for bread and other bake ...
web server interface. It is named after musician
Frank Sinatra
Francis Albert Sinatra (; December 12, 1915 – May 14, 1998) was an American singer and actor. Honorific nicknames in popular music, Nicknamed the "Chairman of the Board" and "Ol' Blue Eyes", he is regarded as one of the Time 100: The Most I ...
.
[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 divides the related program logic into three interconnected elements. These elements are:
* the model, the internal representat ...
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 a round, edible fruit produced by an apple tree (''Malus'' spp.). Fruit trees of the orchard or domestic apple (''Malus domestica''), the most widely grown in the genus, are agriculture, cultivated worldwide. The tree originated ...
, BBC
The British Broadcasting Corporation (BBC) is a British public service broadcaster headquartered at Broadcasting House in London, England. Originally established in 1922 as the British Broadcasting Company, it evolved into its current sta ...
, the British Government's Government Digital Service
The Government Digital Service is a unit of the Government of the United Kingdom's Department for Science, Innovation and Technology, tasked with transforming the provision of online public services.
It was formed in April 2011 by David Camero ...
, LinkedIn
LinkedIn () is an American business and employment-oriented Social networking service, social network. It was launched on May 5, 2003 by Reid Hoffman and Eric Ly. Since December 2016, LinkedIn has been a wholly owned subsidiary of Microsoft. ...
, the National Security Agency
The National Security Agency (NSA) is an 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, collection, and proces ...
, Engine Yard
Engine Yard is a San Francisco, California, based, privately held platform as a service company focused on Ruby on Rails, PHP and Node.js deployment and management.
History
Engine Yard, founded in 2006, offers a cloud application management pl ...
, Heroku
Heroku is a cloud platform as a service (PaaS) supporting several programming languages. As one of the first cloud platforms, Heroku has been in development since June 2007, when it supported only the Ruby programming language, but now also suppo ...
, GitHub
GitHub () is a Proprietary software, proprietary developer platform that allows developers to create, store, manage, and share their code. It uses Git to provide distributed version control and GitHub itself provides access control, bug trackin ...
, 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
Entertainment ...
, and Songbird
A songbird is a bird belonging to the suborder Passeri of the perching birds (Passeriformes). Another name that is sometimes seen as the scientific or vernacular name is Oscines, from Latin ''oscen'', "songbird". The Passeriformes contains 5,00 ...
. Travis CI
Travis CI is a hosted continuous integration service used to build and test software projects hosted on GitHub, Bitbucket, GitLab, Perforce, Apache Subversion and Assembla.
Travis CI was the first CI service that provided services to open-sourc ...
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 and Scalatra
Scalatra is a free and open source web application framework written in Scala. It is a port of the Sinatra framework written in Ruby. Scalatra is an alternative to the Lift, Play!, and Unfiltered frameworks.
Scalatra is an example of a microf ...
.
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 Conferen ...
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