Add /api route to show API version #116

This commit is contained in:
Sylvain Baubeau committed 2015-01-12 10:56:54 +01:00
1 parent 98ca0cdf33
commit 6c7f3b3bbd
2 files changed
+16

No files matched your search

+12
View File
@@ -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)
}