Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
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
Transcript
16 slides
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
More Decks by Luciano Sousa
See All by Luciano Sousa
Playing with Sorbet
lucianosousa
0
64
Knowing mina deploy
lucianosousa
1
90
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
140
Other Decks in Programming
See All in Programming
AI-Powered Domain-Driven Design
ziobrando
0
470
ローカルLLMの基本と近況 2611 / Local LLM basics and recent situation 2611
kishida
3
590
조합이폭발하는디자인시스템이걸눈으로도테스트하라고요
giljongyu
0
780
止まらない比較を止める — 余帰納法で無限ストリームを比べる
tarao
0
190
AI時代のIaC入門 〜なぜインフラをコードで管理したいのか?〜 / Introduction to IaC in the AI Era
akihisaikeda
6
1.6k
Zero-Tap Sign-In対応、結局何をすればいいの?
mitohato14
0
2.4k
Debian JP Projectのサーバー構成
uwabami
1
130
例外からRich Errorsまで Kotlinエラーハンドリングの進化を読み解く
shiita0903
0
220
ビジネスロジックを堅牢に~Scala 3のドメインプリミティブ~
j5ik2o
0
200
あなたの await、OS まで届いてる? strace で覗く JavaScript の非同期
hasutosasaki
1
2.4k
なぜ私たちは「現時点では」KMPの導入を見送ったのか
chigichan24
1
310
作れるエンジニアから、価値を届けるエンジニアへ
ryunakayama
1
310
Featured
See All Featured
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
850
Git: the NoSQL Database
bkeepers
PRO
433
67k
Building AI with AI
inesmontani
PRO
1
1.4k
Test your architecture with Archunit
thirion
2
2.5k
A Tale of Four Properties
chriscoyier
163
24k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.9k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
760
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
The Invisible Side of Design
smashingmag
301
52k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
490
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
2
530
Scaling GitHub
holman
464
140k