Skip to content

Commit

Permalink
Simplified, no more VersionModule
Browse files Browse the repository at this point in the history
  • Loading branch information
applejag committed May 11, 2021
1 parent 1ecb139 commit 50eaf6a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ func main() {
}

modules := []HTTPModule{
VersionModule{},
ProjectModule{Database: db, MessageQueue: mq},
BuildModule{Database: db, MessageQueue: mq},
TokenModule{Database: db},
Expand All @@ -115,6 +114,7 @@ func main() {
module.Register(api)
}

api.GET("/version", getVersionHandler)
api.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))

_ = r.Run()
Expand Down
10 changes: 2 additions & 8 deletions version.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,11 @@ func init() {
}
}

type VersionModule struct{}

func (m VersionModule) Register(g *gin.RouterGroup) {
g.GET("/version", m.getVersion)
}

// getVersion godoc
// getVersionHandler godoc
// @summary Returns the version of this API
// @tags meta
// @success 200 {object} Version
// @router /version [get]
func (m VersionModule) getVersion(c *gin.Context) {
func getVersionHandler(c *gin.Context) {
c.JSON(http.StatusOK, ApiVersion)
}

0 comments on commit 50eaf6a

Please sign in to comment.