Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Sinatra::Ftw
Search
Luciano Sousa
September 18, 2010
Programming
0
93
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
49
Knowing mina deploy
lucianosousa
1
72
Creating your startup without Developer
lucianosousa
0
160
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
組み合わせ爆発にのまれない - 責務分割 x テスト
halhorn
1
160
まだ間に合う!Claude Code元年をふりかえる
nogu66
5
880
Full-Cycle Reactivity in Angular: SignalStore mit Signal Forms und Resources
manfredsteyer
PRO
0
160
Cell-Based Architecture
larchanjo
0
140
公共交通オープンデータ × モバイルUX 複雑な運行情報を 『直感』に変換する技術
tinykitten
PRO
0
160
認証・認可の基本を学ぼう後編
kouyuume
0
250
Graviton と Nitro と私
maroon1st
0
130
俺流レスポンシブコーディング 2025
tak_dcxi
14
9.4k
tsgolintはいかにしてtypescript-goの非公開APIを呼び出しているのか
syumai
7
2.3k
Giselleで作るAI QAアシスタント 〜 Pull Requestレビューに継続的QAを
codenote
0
270
モデル駆動設計をやってみようワークショップ開催報告(Modeling Forum2025) / model driven design workshop report
haru860
0
280
AI 駆動開発ライフサイクル(AI-DLC):ソフトウェアエンジニアリングの再構築 / AI-DLC Introduction
kanamasa
11
3.5k
Featured
See All Featured
sira's awesome portfolio website redesign presentation
elsirapls
0
89
The Cost Of JavaScript in 2023
addyosmani
55
9.4k
The untapped power of vector embeddings
frankvandijk
1
1.5k
What's in a price? How to price your products and services
michaelherold
246
13k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
980
Getting science done with accelerated Python computing platforms
jacobtomlinson
0
76
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.4k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.4k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
290
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
41
How to build a perfect <img>
jonoalderson
0
4.6k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
196
70k
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