From c1ff9e0ec7a6bd6c79b9291a793e12db53ada6e3 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Sat, 6 Jul 2024 02:46:10 +0000 Subject: [PATCH] add version route --- app/app.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/app.go b/app/app.go index 7deb629..2730db2 100644 --- a/app/app.go +++ b/app/app.go @@ -15,6 +15,7 @@ import ( ) var LDAPSessions map[string]*LDAPClient +var APIVersion = "1.0.0" func Run() { gob.Register(LDAPClient{}) @@ -38,6 +39,10 @@ func Run() { LDAPSessions = make(map[string]*LDAPClient) + router.GET("/version", func(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{"version": APIVersion}) + }) + router.POST("/ticket", func(c *gin.Context) { var body Login if err := c.ShouldBind(&body); err != nil { // bad request from binding