Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Sinatra::Ftw
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Luciano Sousa
September 18, 2010
Programming
110
0
Share
Sinatra::Ftw
An introduction about Sinatra Framework
Luciano Sousa
September 18, 2010
More Decks by Luciano Sousa
See All by Luciano Sousa
Playing with Sorbet
lucianosousa
0
55
Knowing mina deploy
lucianosousa
1
81
Creating your startup without Developer
lucianosousa
0
180
Patterns Falacy v2
lucianosousa
0
130
Project Management like Software Developer
lucianosousa
1
120
The Patterns Falacy - Rails Version
lucianosousa
1
130
Other Decks in Programming
See All in Programming
OCRを使ってゲームのアイテムをデータ化する
kishikawakatsumi
0
120
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
2.3k
Spec-Driven Development with AI-Agents: From High-Level Requirements to Working Software
antonarhipov
2
400
プラグインで拡張される Context をtype-safe にする難しさと設計判断
kazupon
2
480
SPMマルチモジュールで テストカバレッジを取得する技法
yosshi4486
0
130
TSKaigi 2026 TypeScriptバックエンドのオブザーバビリティ戦略 — Datadog × NestJSの実践
taiseiyamamotoan
1
210
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
0
230
Oxlintのカスタムルールの現況
syumai
5
920
LLM Plugin for Node-REDの利用方法と開発について
404background
0
150
軽量Java基盤の設計 DIコンテナに頼らない、長期保守と1秒起動の実現 JJUG CCC 2026 Spring
macha64
0
240
iOS26時代の新規アプリ開発
yuukiw00w
0
220
Moments When Things Go Wrong
aurimas
3
130
Featured
See All Featured
How to Ace a Technical Interview
jacobian
281
24k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.4k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
150
Building Adaptive Systems
keathley
44
3k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
150
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
70
39k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
220
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.2k
Exploring anti-patterns in Rails
aemeredith
3
380
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.5k
The Curious Case for Waylosing
cassininazir
1
370
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
390
Transcript
http://twitter.com/lucianosousa 1 Sinatra::Ftw Luciano Sousa
[email protected]
http://lucianosousa.net http://twitter.com/lucianosousa http://github.com/lucianosousa
http://twitter.com/lucianosousa 2 Sinatra::WTF? ✔ Micro Framework web ✔ DSL ✔
Rotas ✔ Múltiplos Templates ✔ Filtros ✔ Exemplos
http://twitter.com/lucianosousa 3 Sinatra::Description Micro Framework para desenvolvimento de aplicações web
com o mínimo de esforço.
http://twitter.com/lucianosousa 4 Sinatra::DSL get '/hi' do “hello world!” end Domain
Specific Language
http://twitter.com/lucianosousa 5 Sinatra::Routes get '/' do “get in index” end
post '/' do “post in index” end put '/' do “put in index” end delete '/' do “delete in index” end get '/:name' do “Hello #{params[:name]}!” end
http://twitter.com/lucianosousa 6 Sinatra::Templates get '/' do “hello world!” end get
'/' do erb :index end get '/' do haml :index end get '/' do erubis :index end
http://twitter.com/lucianosousa 7 Sinatra::Layout get '/' do erb :index end Carrega
arquivo arquivo layout.template dentro da pasta views automagicamente
http://twitter.com/lucianosousa 8
http://twitter.com/lucianosousa 9
http://twitter.com/lucianosousa 10
http://twitter.com/lucianosousa 11
http://twitter.com/lucianosousa 12 Sinatra::Helpers helpers do def sum(value) "Result: #{value.to_i+100}" end
end get '/:value' do sum(params[:value]) end Obs: O parâmetro :value é passado como string para o helper.
http://twitter.com/lucianosousa 13
http://twitter.com/lucianosousa 14 Sinatra::Filters after do puts "Response status is: #{response.status}"
end
http://twitter.com/lucianosousa 15
http://twitter.com/lucianosousa 16 Sinatra::Example