go-nunu/nunu

教程中服务handle注册问题

Closed this issue · 1 comments

func NewServerHTTP(
// ...
orderHandler *handler.OrderHandler, // new ============>>>> 不能是引用类型,否则,下面无法调用方法
) *gin.Engine {
// ...

// 无权限路由
noAuthRouter := r.Group("/").Use(middleware.RequestLogMiddleware(logger))
{
	noAuthRouter.GET("/order", orderHandler.GetOrderById)   // new

感谢指正