Refactoring: simplify version generation. Rename API to /api/version. #167

This commit is contained in:
Andrey Smirnov
2015-01-13 18:47:41 +03:00
parent 982b5dc886
commit d489694ea9
2 changed files with 4 additions and 5 deletions

View File

@@ -12,9 +12,7 @@ import (
// 3. SnapshotCollection
// 4. PublishedRepoCollection
// GET /api
// GET /api/version
func apiVersion(c *gin.Context) {
api := make(map[string]string)
api["Version"] = aptly.Version
c.JSON(200, api)
c.JSON(200, gin.H{"Version": aptly.Version})
}

View File

@@ -16,8 +16,9 @@ func Router(c *ctx.AptlyContext) http.Handler {
router.Use(gin.ErrorLogger())
root := router.Group("/api")
{
root.GET("/", apiVersion)
root.GET("/version", apiVersion)
}
{