Database Reference
In-Depth Information
Figure 10-5. Snapshot of the imported project
Sinatra Web Framework for Ruby
Sinatra is a Ruby implementation of what is often called a micro framework . The aim of a micro framework is to help
you quickly build out powerful web applications and APIs only using what is absolutely necessary to get the job done
(Listing 10-1).
Listing 10-1. Sinatra Example of GET Route
# home page
get '/' do
@title = "Home"
mustache :"home/index"
end
Sinatra is maintained by blake Mizerany and supported by a number of equally outstanding committers. If you
would like to get involved with Sinatra, please visit https://github.com/sinatra/sinatra .
Note
The starting point for the Sinatra application is the {PROJECTROOT}/app/config.ru file, which is shown in Listing 10-2.
Listing 10-2. The config.ru File
root = ::File.dirname(__FILE__)
require ::File.join( root, 'graphstory' )
run App.new
The {PROJECTROOT}/app/graphstory.rb file contains the global application settings, such as the database
connection and the requests routes. An abbreviated version of the file is shown in Listing 10-3.
 
 
Search WWH ::




Custom Search