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
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
52
Knowing mina deploy
lucianosousa
1
77
Creating your startup without Developer
lucianosousa
0
180
Patterns Falacy v2
lucianosousa
0
120
Project Management like Software Developer
lucianosousa
1
120
The Patterns Falacy - Rails Version
lucianosousa
1
120
Other Decks in Programming
See All in Programming
HTML-Aware ERB: The Path to Reactive Rendering @ RubyKaigi 2026, Hakodate, Japan
marcoroth
0
670
PHPでバイナリをパースして理解するASN.1
muno92
PRO
0
430
AWSはOSSをどのように 考えているのか?
akihisaikeda
0
100
tRPCの概要と少しだけパフォーマンス
misoton665
2
270
ローカルLLMでどこまでコードが書けるか / How much code can be written on a local LLM
kishida
2
340
2026年のソフトウェア開発を考える(2026/05版) / Software Engineering Scrum Fest Niigata 2026 Edition
twada
PRO
22
12k
20260514 - build with ai 2026 - build LINE Bot with Gemini CLI
line_developers_tw
PRO
0
380
PHPでローカル環境用のSSL/TLS証明書を発行することはできるのか? #phpconkagawa
akase244
0
350
ソフトウェア設計の結合バランス #phperkaigi
kajitack
0
500
Building on Bluesky's AT Protocol with Ruby
mackuba
0
110
AI時代になぜ書くのか
mutsumix
0
340
実用!Hono RPC2026
yodaka
2
310
Featured
See All Featured
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
300
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
320
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.2k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
180
Building Applications with DynamoDB
mza
96
7k
Evolving SEO for Evolving Search Engines
ryanjones
0
190
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
150
My Coaching Mixtape
mlcsv
0
120
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.6k
Prompt Engineering for Job Search
mfonobong
0
300
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
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