Micro Web Framework
• Built on top of Rack
• Uses RESTful thinking
• URL’s are king
• Routing to code blocks
• Static Files
Routing To Blocks
• Routes made up of 3 basic parts
• HTTP Verb
• Match Expression
• Code block
Serving Public Files
no matching URL was found, Sinatra checks
the public folder
• Public folder can be changed by setting :public
• Views are mixes of code and
• Sinatra works with ERB, HAML, and Builder by
• Views are kept in a folder at the root of the site
• View folder can be changed by setting :views
• Layouts are like templates for all your pages.
• Bydefault looks for a file called “layout” in
views with the same extension as the view you
• Default name can be overridden.
• Filters run before all routes.
• Theycan modify the Request and Response
• Any instance variable created in the before filter
is available in the route.
• Small methods that you find useful.
• Available within the route and within the views.