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
MiddlewarePattern.pdf
Search
ayato
September 11, 2015
Programming
220
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
MiddlewarePattern.pdf
ayato
September 11, 2015
Transcript
14 slides
Middleware Pattern @_ayato_p/Cybozu Startups, Inc.
(def _ayato_p {:name "あやぴー" :lang
[:clojure :ruby :javascript] :company "Cybozu Startups, Inc."})
(def _ayato_p {:name "あやぴー" :lang
[:clojure :ruby :javascript] :company "Cybozu Startups, Inc."}) Clojure 歴、半年
Agenda Ring Ring Middleware Middleware Pattern
Ring
Ring サーバーを抽象化する仕様/デファクトスタンダード Ring Handler, Requests, Responses, Middleware 公式には
jetty のアダプタがある 最近で Ring インターフェイスを実装したものだと Immutant などがある
Ring Middleware
Ring Middleware ただの高階関数 Ring Middleware の場合、 Handler を受け取って
Request を受け取る関数を返すような書き方されてる
Ring Middleware (defn wrap-secret-key[handler secret-key] (fn [req]
(handler (assoc-in req [:params :secret-key] secret-key)))) (defn make-handler [handler] (-> handler (wrap-secret-key "This is secret!!") wrap-something wrap-anything wrap-defaults)) (app (make-handler (get-ring-handler)))
Middleware Pattern
Middleware Pattern Ring Middleware はひとつの Middleware Pattern 例 他には
Boot でも適用されている
Use case ユーザーの入力を受け取って、関数を適用するか決めたい config ファイルを使って、関数を適用するか決めたい LazySeq に適用する関数をオプションから決めたい
-> Composable な関数を作りたい!!
Conclusion Composable な関数を書くお供に Middleware Pattern を活用しよう
Enjoy Clojure
More Decks by ayato
See All by ayato
マイクロサービス内で動くAPIをF#で書いている
ayato0211
1
1.8k
Clojureという言語が私逹にもたらしたもの
ayato0211
6
3.2k
3年間考え続けてきたWebアプリケーションにおけるテストの話
ayato0211
3
330
Re:REPL-Driven Development
ayato0211
3
1.4k
Meta Template Engine
ayato0211
2
1.2k
超変換! Hiccup data structure!!
ayato0211
2
700
About Integrant
ayato0211
0
620
Muscle Assert
ayato0211
0
340
Clojureを用いたWebアプリケーション開発
ayato0211
2
3.3k
Other Decks in Programming
See All in Programming
Kotlin Fest 2026: Kotlin コンパイラに Contribute してみよう! - Kotlin/Wasm で深い再帰を書けるようにした話
ternbusty
1
400
クラウドゲーミングのパフォーマンス最適化に挑む / Cloud Gaming Performance Tuning
vivion
0
360
AppFunctionsの内部実装を紐解く
hiroaki404
0
100
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
170
DroidKnights 2026 Android A2UI Jetpack Compose 기반의 안전한 AI UI 렌더링 - 박제창
itsmedreamwalker
1
260
AIがコードを書いてくれる時代、我々は何を確かめるのか
yosuke_furukawa
PRO
13
6.1k
SFCで実現する病院・医療システムの動的組み立て式UI
koukimiura
1
180
[Kotlin Fest 2026] eBPF Tracing for Kotlin
takehaya
1
390
[DroidKnights 2026] Workflow AX 적용기 — 자동 정책 정리부터 E2E까지
dayeon
0
120
Snowflake Openflow Connector利用の勘所 / 20261024developersio2026tokyo-snowflake-openflow
kasacchiful
PRO
0
360
Beyond Chatbots: Agentic UI with Open Standards @W-JAX 2026, München
manfredsteyer
PRO
0
120
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
390
Featured
See All Featured
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
43k
[RailsConf 2023] Rails as a piece of cake
palkan
59
7.2k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
1
250
The Language of Interfaces
destraynor
162
27k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
760
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
400
Well, that’s weird…
csswizardry
1
150
Why Our Code Smells
bkeepers
PRO
340
58k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
2
540
Mobile First: as difficult as doing things right
swwweet
225
10k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
2
990
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
850