mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-22 17:31:03 +01:00
Add API GetVersion
This commit is contained in:
@@ -32,3 +32,4 @@ task:
|
||||
workers: 4
|
||||
other:
|
||||
tmppath: "/tmp"
|
||||
version: v0.4.1
|
||||
@@ -176,6 +176,8 @@ func main() {
|
||||
authGroup.POST("/users/:id", routes.PostUser) // 更改用户
|
||||
authGroup.DELETE("/users/:id", routes.DeleteUser) // 删除用户
|
||||
authGroup.GET("/me", routes.GetMe) // 获取自己账户
|
||||
//release版本
|
||||
authGroup.GET("/version", routes.GetVersion) //获取发布的版本
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
17
backend/routes/version.go
Normal file
17
backend/routes/version.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package routes
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/spf13/viper"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func GetVersion(c *gin.Context) {
|
||||
version := viper.GetString("version")
|
||||
|
||||
c.JSON(http.StatusOK, Response{
|
||||
Status: "ok",
|
||||
Message: "success",
|
||||
Data: version,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user