Merge branch 'lebauce-api-version'

This commit is contained in:
Andrey Smirnov
2015-01-13 18:49:57 +03:00
3 changed files with 16 additions and 0 deletions
+10
View File
@@ -1,8 +1,18 @@
// 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/version
func apiVersion(c *gin.Context) {
c.JSON(200, gin.H{"Version": aptly.Version})
}
+5
View File
@@ -16,6 +16,11 @@ func Router(c *ctx.AptlyContext) http.Handler {
router.Use(gin.ErrorLogger())
root := router.Group("/api")
{
root.GET("/version", apiVersion)
}
{
root.GET("/repos", apiReposList)
root.POST("/repos", apiReposCreate)
+1
View File
@@ -5,3 +5,4 @@ Testing aptly REST API
from .repos import *
from .files import *
from .publish import *
from .version import *