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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Luciano Sousa
September 18, 2010
Programming
0
110
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
52
Knowing mina deploy
lucianosousa
1
77
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
120
Other Decks in Programming
See All in Programming
GC言語のWasm化とComponent Modelサポートの実践と課題 - Scalaの場合
tanishiking
0
130
The free-lunch guide to idea circularity
hollycummins
0
350
20260313 - Grafana & Friends Taipei #1 - Kubernetes v1.36 的開發雜記:那些困在 Alpha 加護病房太久的 Metrics
tico88612
0
230
テレメトリーシグナルが導くパフォーマンス最適化 / Performance Optimization Driven by Telemetry Signals
seike460
PRO
2
160
How to stabilize UI tests using XCTest
akkeylab
0
140
2026-03-27 #terminalnight 変数展開とコマンド展開でターミナル作業をスマートにする方法
masasuzu
0
120
Goの型安全性で実現する複数プロダクトの権限管理
ishikawa_pro
2
1.4k
「接続」—パフォーマンスチューニングの最後の一手 〜点と点を結ぶ、その一瞬のために〜
kentaroutakeda
3
1.9k
20260315 AWSなんもわからん🥲
chiilog
2
170
Pythonデータ分析コトハジメinFukuoka
kanan
0
100
AI Assistants for Your Angular Solutions
manfredsteyer
PRO
0
160
Nuxt Server Components
wattanx
0
120
Featured
See All Featured
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
360
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Tell your own story through comics
letsgokoyo
1
870
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
Typedesign – Prime Four
hannesfritz
42
3k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.5k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Believing is Seeing
oripsolob
1
94
How to build a perfect <img>
jonoalderson
1
5.3k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.2k
Principles of Awesome APIs and How to Build Them.
keavy
128
17k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
199
73k
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