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
120
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
56
Knowing mina deploy
lucianosousa
1
83
Creating your startup without Developer
lucianosousa
0
190
Patterns Falacy v2
lucianosousa
0
140
Project Management like Software Developer
lucianosousa
1
120
The Patterns Falacy - Rails Version
lucianosousa
1
130
Other Decks in Programming
See All in Programming
仕様駆動開発の消費期限
watany
20
9k
<title><a id="</title>君はこのHTMLをパースできるか"></a></title> #雑LT_study
pizzacat83
0
180
in-process GraphQL のすすめ #ginzajs
izumin5210
4
1.5k
【QA Test Talk Vol.8】AI-DLC による Whole Team Approach の加速
pkshadeck
PRO
0
240
Hono + Inertia + React で LP を構築した話
oukayuka
2
160
承認済みなのに差戻しできてしまうバグ、型で潰せます
shinchit
0
110
ソフトウェアエンジニアにとっての生成AI - 特性を知って使い倒す / generative ai for software enginner
kishida
7
2.1k
Oxlintはいいぞ(続)
yug1224
1
450
「人を評価する AI」の設計と実装
ryoyanara
0
240
そこに3びきプロダクトがいるじゃろう——生成AI時代における“価値が届かない理由”の構造
kosuket
0
580
ALB ログから Trace を気合で繋げる技術
fohte
5
470
komatsuna「分散システムにおけるバグ分析手法」
komatsunaqa
0
280
Featured
See All Featured
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
800
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
300
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
430
GitHub's CSS Performance
jonrohan
1033
470k
How STYLIGHT went responsive
nonsquared
100
6.2k
Into the Great Unknown - MozCon
thekraken
41
2.7k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.5k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.5k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
280
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
380
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
580
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