Merge branch 'api-version' of https://github.com/lebauce/aptly into lebauce-api-version

This commit is contained in:
Andrey Smirnov
2015-01-13 18:44:10 +03:00
2 changed files with 16 additions and 0 deletions
+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)
}
+4
View File
@@ -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)