Custom Middleware
Middleware คืออะไร
Section titled “Middleware คืออะไร”Middleware เป็น layer ที่อยู่ระหว่าง request และ view โดยจะ process ทุก request ที่เข้ามาและทุก response ที่ออกไป เหมือนกับ “กรอง” ที่ทุก request ต้องผ่าน
ทำไมใช้ Middleware
Section titled “ทำไมใช้ Middleware”| Use Case | Description |
|---|---|
| Logging | บันทึก request/response |
| Authentication | ตรวจสอบ user |
| Performance | วัด response time |
| Security | ตรวจสอบ headers, rate limiting |
| Cross-cutting | งานที่ต้องทำกับทุก request |
| Error handling | จัดการ exceptions |
เข้าสู่ระบบเพื่อดูเนื้อหาเต็ม
ยืนยันตัวตนด้วยบัญชี Google เพื่อปลดล็อกบทความทั้งหมด
Login with Google