mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-07-16 12:08:04 +00:00
Add /api route to show API version #116
This commit is contained in:
+12
@@ -1,8 +1,20 @@
|
|||||||
// Package api provides implementation of aptly REST API
|
// Package api provides implementation of aptly REST API
|
||||||
package api
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/smira/aptly/aptly"
|
||||||
|
)
|
||||||
|
|
||||||
// Lock order acquisition (canonical):
|
// Lock order acquisition (canonical):
|
||||||
// 1. RemoteRepoCollection
|
// 1. RemoteRepoCollection
|
||||||
// 2. LocalRepoCollection
|
// 2. LocalRepoCollection
|
||||||
// 3. SnapshotCollection
|
// 3. SnapshotCollection
|
||||||
// 4. PublishedRepoCollection
|
// 4. PublishedRepoCollection
|
||||||
|
|
||||||
|
// GET /api
|
||||||
|
func apiVersion(c *gin.Context) {
|
||||||
|
api := make(map[string]string)
|
||||||
|
api["Version"] = aptly.Version
|
||||||
|
c.JSON(200, api)
|
||||||
|
}
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ func Router(c *ctx.AptlyContext) http.Handler {
|
|||||||
router.Use(gin.ErrorLogger())
|
router.Use(gin.ErrorLogger())
|
||||||
|
|
||||||
root := router.Group("/api")
|
root := router.Group("/api")
|
||||||
|
{
|
||||||
|
root.GET("/", apiVersion)
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
root.GET("/repos", apiReposList)
|
root.GET("/repos", apiReposList)
|
||||||
root.POST("/repos", apiReposCreate)
|
root.POST("/repos", apiReposCreate)
|
||||||
|
|||||||
Reference in New Issue
Block a user