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
110
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
82
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
The Bowling Game- From Imperative to Functional Programming - Part 1
philipschwarz
PRO
0
310
言語を使う側から、作る側へ。 自作 Lisp で得た新たな気づき。
andpad
0
110
SREは、MCPとSRE Agentをこう使え!
kazumax55
0
150
任せる範囲はこう広がった / How the Scope of AI Delegation Has Expanded
nrslib
1
250
Hatena Engineer Seminar #37「言語モデルの活用に関する研究」
slashnephy
0
510
共通化で考えるべきは、実装より公開する型だった
codeegg
0
210
Contextとはなにか
chiroruxx
1
390
Performance Engineering for Everyone
elenatanasoiu
0
270
「正の参照」と 「負の導出」で組む ハーネスエンジニアリング
cottpan
1
140
Even G2とAWSで推しのエージェントを召喚しよう!
har1101
1
160
吝嗇家のためのAI活用 / AI development for miser - ChatGPT + Issue Driven Development
tooppoo
0
180
エンジニア向け会社紹介/Findy Company Profile
findyinc
6
360k
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
How STYLIGHT went responsive
nonsquared
100
6.2k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
320
Navigating Team Friction
lara
192
16k
Producing Creativity
orderedlist
PRO
348
40k
Visualization
eitanlees
152
17k
Speed Design
sergeychernyshev
33
1.9k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
340
Done Done
chrislema
186
16k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
120k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
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