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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
52
Knowing mina deploy
lucianosousa
1
76
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
API Platformを活用したPHPによる本格的なWeb API開発 / api-platform-book-intro
ttskch
1
120
DevinとClaude Code、SREの現場で使い倒してみた件
karia
1
970
エラーログのマスキングの仕組みづくりに役立ったASTの話
kumoichi
0
110
米国のサイバーセキュリティタイムラインと見る Goの暗号パッケージの進化
tomtwinkle
2
460
TROCCOで実現するkintone+BigQueryによるオペレーション改善
ssxota
0
140
Unity6.3 AudioUpdate
cova8bitdots
0
110
nilとは何か 〜interfaceの構造とnil!=nilから理解する〜
kuro_kurorrr
3
1.7k
AIプロダクト時代のQAエンジニアに求められること
imtnd
2
740
モジュラモノリスにおける境界をGoのinternalパッケージで守る
magavel
0
3.5k
maplibre-gl-layers - 地図に移動体たくさん表示したい
kekyo
PRO
0
210
RAGでハマりがちな"Excelの罠"を、データの構造化で突破する
harumiweb
9
2.6k
15年目のiOSアプリを1から作り直す技術
teakun
1
610
Featured
See All Featured
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.6k
Automating Front-end Workflow
addyosmani
1370
200k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.1k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
199
73k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
220
Embracing the Ebb and Flow
colly
88
5k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
460
Site-Speed That Sticks
csswizardry
13
1.1k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.1k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
100
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
170
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