Skip to content

Commit

Permalink
refactor: Methond name
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Castell committed Oct 16, 2018
1 parent aed2f44 commit 39728d0
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions dkron/api.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package dkron

import (
"flag"
"fmt"
"net/http"
"strconv"
Expand Down Expand Up @@ -35,17 +34,11 @@ func NewTransport(a *Agent) *HTTPTransport {
}

func (h *HTTPTransport) ServeHTTP() {
if flag.Lookup("test.v") != nil {
gin.SetMode(gin.TestMode)
} else if log.Level >= logrus.InfoLevel {
gin.SetMode(gin.ReleaseMode)
}

h.Engine = gin.Default()
h.Engine.HTMLRender = CreateMyRender()
rootPath := h.Engine.Group("/")

h.ApiRoutes(rootPath)
h.APIRoutes(rootPath)
h.agent.DashboardRoutes(rootPath)

h.Engine.Use(h.MetaMiddleware())
Expand All @@ -58,8 +51,8 @@ func (h *HTTPTransport) ServeHTTP() {
go h.Engine.Run(h.agent.config.HTTPAddr)
}

// apiRoutes registers the api routes on the gin RouterGroup.
func (h *HTTPTransport) ApiRoutes(r *gin.RouterGroup) {
// APIRoutes registers the api routes on the gin RouterGroup.
func (h *HTTPTransport) APIRoutes(r *gin.RouterGroup) {
v1 := r.Group("/v1")
v1.GET("/", h.indexHandler)
v1.GET("/members", h.membersHandler)
Expand Down

0 comments on commit 39728d0

Please sign in to comment.