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
Luciano Sousa
September 18, 2010
Programming
0
100
Sinatra::Ftw
An introduction about Sinatra Framework
Luciano Sousa
September 18, 2010
Tweet
Share
More Decks by Luciano Sousa
See All by Luciano Sousa
Playing with Sorbet
lucianosousa
0
51
Knowing mina deploy
lucianosousa
1
74
Creating your startup without Developer
lucianosousa
0
170
Patterns Falacy v2
lucianosousa
0
120
Project Management like Software Developer
lucianosousa
1
110
The Patterns Falacy - Rails Version
lucianosousa
1
110
Other Decks in Programming
See All in Programming
ふん…おもしれぇ Parser。RubyKaigi 行ってやるぜ
aki_pin0
0
120
AIコーディングの理想と現実 2026 | AI Coding: Expectations vs. Reality 2026
tomohisa
0
730
CSC307 Lecture 14
javiergs
PRO
0
440
Go1.26 go fixをプロダクトに適用して困ったこと
kurakura0916
0
310
20260228_JAWS_Beginner_Kansai
takuyay0ne
4
340
クライアントワークでSREをするということ。あるいは事業会社におけるSREと同じこと・違うこと
nnaka2992
0
180
AIとペアプロして処理時間を97%削減した話 #pyconshizu
kashewnuts
1
170
ぼくの開発環境2026
yuzneri
1
290
CSC307 Lecture 12
javiergs
PRO
0
450
AIに仕事を丸投げしたら、本当に楽になれるのか
dip_tech
PRO
0
170
Beyond the Basics: Signal Forms
manfredsteyer
PRO
0
100
new(1.26) ← これすき / kamakura.go #8
utgwkk
0
420
Featured
See All Featured
Agile that works and the tools we love
rasmusluckow
331
21k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
370
Documentation Writing (for coders)
carmenintech
77
5.3k
How to build a perfect <img>
jonoalderson
1
5.2k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
82
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
940
The Limits of Empathy - UXLibs8
cassininazir
1
240
Done Done
chrislema
186
16k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
Art, The Web, and Tiny UX
lynnandtonic
304
21k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
60
42k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
78
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