关于认证的问题
i-coder-robot opened this issue · 1 comments
i-coder-robot commented
在part3里,有需要认证的需求
// 新建订单接口
authHandler := http.HandlerFunc(handler.PayOrder)
service.Handle("/payment/pay-order", handler.AuthWrapper(authHandler))
这个代码执行流程是什么,不是很理解,求赐教~
jackycsl commented
这是middleware的standard pattern.
AuthWrapper 里确保 token 是 valid 后,才运行 pay order 的功能。