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
play2stub さらっと概要
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Satoshi Kobayashi
February 21, 2015
Technology
360
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
play2stub さらっと概要
play2stub の概要を少し作成しました。処理イメージのページを中心に御覧ください。
Satoshi Kobayashi
February 21, 2015
More Decks by Satoshi Kobayashi
See All by Satoshi Kobayashi
AI に「学ばせ、調べさせ、作らせる」。Auth0 開発を加速させる7つの実践的アプローチ
scova0731
0
1.8k
「図面」から「法則」へ 〜メタ視点で読み解く現代のソフトウェアアーキテクチャ〜
scova0731
0
2.1k
Other Decks in Technology
See All in Technology
"優秀な誰か"の下位互換にならないために
yut0naga1_fa
1
1.8k
Classmethod Company Deck
satoshi7
1
730
Persisting Massive Data with Rails ~Designing for 60 billion rows, and fighting the bottlenecks~ Railsで挑む大量データ永続化 〜600億件を永続化するための設計とボトルネックとの戦い〜
occhi
0
730
AI駆動で「他アプリの音を加工できる」アプリを作った
satomasahiro2005
0
170
Tofu-Controller lightning talk @ Containerday 2026
gionn
0
120
Conditional PED-ANOVA: Hyperparameter Importance in Hierarchical & Dynamic Search Spaces
pfn
PRO
0
140
実践!Cloud Run ハンズオン!! / Cloud Run handson
y0hgi
2
290
FinOps Agentが生んだ技術負債:コスト自動調査の落とし穴と解消までの道のり
oasis1994liveforever
1
120
日本語に強いオープンな大規模言語モデル「LLM-jp」
odashi
5
1.2k
無理せず続ける、子育てエンジニアの学び
codmoninc
PRO
0
970
DGX Spark でどこまでハッキングができるのか?
kash1064
3
1.4k
初海外で注意すべきこと12選!!!安全快適なre:invent生活にするために
yuuuuuuu168
1
180
Featured
See All Featured
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
Side Projects
sachag
456
43k
Automating Front-end Workflow
addyosmani
1369
210k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
22k
Being A Developer After 40
akosma
92
590k
How to make the Groovebox
asonas
2
2.5k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
270
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.7k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
330
Faster Mobile Websites
deanohume
310
32k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
450
Transcript
play2stub さらっと概要 @scova0731 as of 2015.02.21
play2stub のユースケース play2stubの役割がわかりにくいということで軽く文書化。 ✓ クライアント開発時のスタブサーバとして ✓ あるリクエストにはあるJSONを返す、特定のHTMLを描画して返す。 ✓ Aeromock さんに出発点は似てそうですが、もっと簡易で、Play
Framework に 依存。 ✓ プロキシっぽいサーバとして ✓ クライアントからのJSONでのリクエストを、更に内部の API サーバに経由し、 レスポンスをそのまま返したい場合 ✓ 一方、認証やHTML生成、HTTPヘッダーの修正などもおこないたい
play2stub を使うメリット 1. 前提知識は Play だけ。Play 環境のためのツール。 Play Framework に大部分を依存しているので、独自
感が薄い 2. とりあえずダミーレスポンスをおいて、クライアント開発を並行に進められる。ダミーのレスポンスは段階的 に本実装に置き換えていける 3. 簡単で冗長な部分が設定のみでよくなる 4. Filter、Processor、Renderer など処理の各所を変更可 (次ページ) 5. play2stub 自体が Play のプラグインに過ぎないので、使えない部分は普通にコードを書けばいいという安 心感 6. メンバーが多い時にコードに一定の規律を与えられるという副作用
処理イメージ Web Server (Play) HTML JSON Controller play2stub Controller Before
Filter After Filter Processor Param Injector API Server (Play) Template Resolver ・・・ Device Aware Template Resolver Renderer Handlebars Template Processor JSON Processor Proxy Processor Add Special Header Form to JSON Error Pages Rendering JSON 特定のエラーの場合 (Forbidden)に、 エラーページを描画する 例えばヘッダーを加えたりとか、 フォームの値は、すべて JSONに置換 したりとか。 たとえば、モバイルの場合にテンプ レートを分けることができる テンプレートで、 QueryStringやURL の情報を使えるようにする サーブレット的な発想。 Before Filter で Request を変更したり(イミュー タブルなので実際にはコピーすることになりそうですが )し、Processor で Result を作成、その後に After Filter で Result を改変したりする。 your play app. play2stub 特別なリクエストは特別なコード を書く。ここから部分的に Processorだけ呼んだり等も可能 開発時には、 Proxyを経由せずに Template/JSONで直接返せる (もとも とのstubの由来) 開発時には、 Proxyを経由せずに Template/JSONで直接返せる
Getting Started とりあえず動かしてみましょう。 $ git clone
[email protected]
:bizreach/play2-stub.git $ cd play2-stub/src/test/play2-sample1-stub
$ ./activator run http://localhost:9000/ にアクセス! - conf/routes をチェック - conf/application.conf をチェック
FAQ Q. 実績は?継続してメンテされるの? A. BizReach の新サービス中の複数の Play サーバで利用されています。しばらくは継 続的に更新されるのではないかと。 Q.
中を見てみたんですが・・・ A. はい、微妙です。テストコードはなく、可読性が低い箇所も。。