diff --git a/api.go b/api.go index 9a2f41e..ee27f2e 100644 --- a/api.go +++ b/api.go @@ -54,6 +54,12 @@ func (e *Engine) POST(uri string, handler Handler) { e.Engine.POST(uri, h) } +func (e *Engine) GET(uri string, handler Handler) { + h := handlerWrapper(handler) + log.Infof("api handler [%v] registor success", handler) + e.Engine.GET(uri, h) +} + // handlerWrapper func handlerWrapper(handler Handler) gin.HandlerFunc { handlerFunc := handler.HandlerFunc() diff --git a/routes.go b/routes.go index fe48b6d..eddcd71 100644 --- a/routes.go +++ b/routes.go @@ -47,6 +47,7 @@ type Handler interface { type HandlerFunc func(*Context) error type IRoutes interface { + GET(uri string, handler Handler) POST(uri string, handler Handler) }