Lesson 12: 隱形的翻譯官-Middleware 中介層的應用場景
想像今天要進入一個戒備森嚴的皇宮(核心商業邏輯 Controller/Service): 大門警衛:檢查你有沒有通行證(Authentication)。 安檢人員:檢查你有沒有攜帶危險物品(Input Validation/Sanitization)。 禮儀官:看你是哪國人,幫你掛上對應語言的翻譯機(Localization)。 記錄員:記下幾點幾分誰進去了(Logging)。 這四個角色,就是 Middleware。它們不負責「處理皇宮內的政務」(那是 Controller 的事)...
Dec 14, 20253 min read14

