diff --git a/api/api.go b/api/api.go index a4d4be16..182d2536 100644 --- a/api/api.go +++ b/api/api.go @@ -1,8 +1,20 @@ // Package api provides implementation of aptly REST API package api +import ( + "github.com/gin-gonic/gin" + "github.com/smira/aptly/aptly" +) + // Lock order acquisition (canonical): // 1. RemoteRepoCollection // 2. LocalRepoCollection // 3. SnapshotCollection // 4. PublishedRepoCollection + +// GET /api +func apiVersion(c *gin.Context) { + api := make(map[string]string) + api["Version"] = aptly.Version + c.JSON(200, api) +} diff --git a/api/router.go b/api/router.go index 3e5b5efd..0eb6827e 100644 --- a/api/router.go +++ b/api/router.go @@ -16,6 +16,10 @@ func Router(c *ctx.AptlyContext) http.Handler { router.Use(gin.ErrorLogger()) root := router.Group("/api") + { + root.GET("/", apiVersion) + } + { root.GET("/repos", apiReposList) root.POST("/repos", apiReposCreate)